Commit 3a1e8654 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰

[3589] Trailing underscores added to OptionDescriptor members.

parent 3307c992
......@@ -600,8 +600,8 @@ Dhcpv4Srv::appendRequestedOptions(const Pkt4Ptr& question, Pkt4Ptr& msg) {
opt != requested_opts.end(); ++opt) {
if (!msg->getOption(*opt)) {
OptionDescriptor desc = subnet->getCfgOption()->get("dhcp4", *opt);
if (desc.option && !msg->getOption(*opt)) {
msg->addOption(desc.option);
if (desc.option_ && !msg->getOption(*opt)) {
msg->addOption(desc.option_);
}
}
}
......@@ -651,8 +651,8 @@ Dhcpv4Srv::appendRequestedVendorOptions(const Pkt4Ptr& question, Pkt4Ptr& answer
if (!vendor_rsp->getOption(*code)) {
OptionDescriptor desc = subnet->getCfgOption()->get(vendor_id,
*code);
if (desc.option) {
vendor_rsp->addOption(desc.option);
if (desc.option_) {
vendor_rsp->addOption(desc.option_);
added = true;
}
}
......@@ -690,8 +690,8 @@ Dhcpv4Srv::appendBasicOptions(const Pkt4Ptr& question, Pkt4Ptr& msg) {
// Check whether option has been configured.
OptionDescriptor desc = subnet->getCfgOption()->
get("dhcp4", required_options[i]);
if (desc.option) {
msg->addOption(desc.option);
if (desc.option_) {
msg->addOption(desc.option_);
}
}
}
......@@ -1951,9 +1951,9 @@ bool Dhcpv4Srv::classSpecificProcessing(const Pkt4Ptr& query, const Pkt4Ptr& rsp
OptionDescriptor desc = subnet->getCfgOption()->
get("dhcp4", DHO_BOOT_FILE_NAME);
if (desc.option) {
if (desc.option_) {
boost::shared_ptr<OptionString> boot =
boost::dynamic_pointer_cast<OptionString>(desc.option);
boost::dynamic_pointer_cast<OptionString>(desc.option_);
if (boot) {
std::string filename = boot->getValue();
rsp->setFile((const uint8_t*)filename.c_str(), filename.size());
......
......@@ -324,30 +324,30 @@ public:
size_t expected_data_len,
bool extra_data = false) {
// Check if option descriptor contains valid option pointer.
ASSERT_TRUE(option_desc.option);
ASSERT_TRUE(option_desc.option_);
// Verify option type.
EXPECT_EQ(expected_code, option_desc.option->getType());
EXPECT_EQ(expected_code, option_desc.option_->getType());
// We may have many different option types being created. Some of them
// have dedicated classes derived from Option class. In such case if
// we want to verify the option contents against expected_data we have
// to prepare raw buffer with the contents of the option. The easiest
// way is to call pack() which will prepare on-wire data.
util::OutputBuffer buf(option_desc.option->getData().size());
option_desc.option->pack(buf);
util::OutputBuffer buf(option_desc.option_->getData().size());
option_desc.option_->pack(buf);
if (extra_data) {
// The length of the buffer must be at least equal to size of the
// reference data but it can sometimes be greater than that. This is
// because some options carry suboptions that increase the overall
// length.
ASSERT_GE(buf.getLength() - option_desc.option->getHeaderLen(),
ASSERT_GE(buf.getLength() - option_desc.option_->getHeaderLen(),
expected_data_len);
} else {
ASSERT_EQ(buf.getLength() - option_desc.option->getHeaderLen(),
ASSERT_EQ(buf.getLength() - option_desc.option_->getHeaderLen(),
expected_data_len);
}
// Verify that the data is correct. Do not verify suboptions and a header.
const uint8_t* data = static_cast<const uint8_t*>(buf.getData());
EXPECT_EQ(0, memcmp(expected_data, data + option_desc.option->getHeaderLen(),
EXPECT_EQ(0, memcmp(expected_data, data + option_desc.option_->getHeaderLen(),
expected_data_len));
}
......@@ -380,7 +380,7 @@ public:
// The subnet should now hold one option with the specified option code.
OptionDescriptor desc =
getOptionFromSubnet(IOAddress("192.0.2.24"), option_code);
ASSERT_TRUE(desc.option);
ASSERT_TRUE(desc.option_);
testOption(desc, option_code, expected_data, expected_data_len);
}
......@@ -1885,16 +1885,16 @@ TEST_F(Dhcp4ParserTest, optionDataTwoSpaces) {
ASSERT_TRUE(subnet);
// Try to get the option from the space dhcp4.
OptionDescriptor desc1 = subnet->getCfgOption()->get("dhcp4", 56);
ASSERT_TRUE(desc1.option);
EXPECT_EQ(56, desc1.option->getType());
ASSERT_TRUE(desc1.option_);
EXPECT_EQ(56, desc1.option_->getType());
// Try to get the option from the space isc.
OptionDescriptor desc2 = subnet->getCfgOption()->get("isc", 56);
ASSERT_TRUE(desc2.option);
EXPECT_EQ(56, desc1.option->getType());
ASSERT_TRUE(desc2.option_);
EXPECT_EQ(56, desc1.option_->getType());
// Try to get the non-existing option from the non-existing
// option space and expect that option is not returned.
OptionDescriptor desc3 = subnet->getCfgOption()->get("non-existing", 56);
ASSERT_FALSE(desc3.option);
ASSERT_FALSE(desc3.option_);
}
// The goal of this test is to verify that it is possible to
......@@ -2045,17 +2045,17 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
// Get the option.
OptionDescriptor desc = subnet->getCfgOption()->get("dhcp4", 222);
EXPECT_TRUE(desc.option);
EXPECT_EQ(222, desc.option->getType());
EXPECT_TRUE(desc.option_);
EXPECT_EQ(222, desc.option_->getType());
// This opton should comprise two sub-options.
// One of them is 'foo' with code 1.
OptionPtr option_foo = desc.option->getOption(1);
OptionPtr option_foo = desc.option_->getOption(1);
ASSERT_TRUE(option_foo);
EXPECT_EQ(1, option_foo->getType());
// ...another one 'foo2' with code 2.
OptionPtr option_foo2 = desc.option->getOption(2);
OptionPtr option_foo2 = desc.option_->getOption(2);
ASSERT_TRUE(option_foo2);
EXPECT_EQ(2, option_foo2->getType());
}
......@@ -2152,7 +2152,7 @@ TEST_F(Dhcp4ParserTest, optionDataBoolean) {
// The subnet should now hold one option with the code 19.
OptionDescriptor desc = getOptionFromSubnet(IOAddress("192.0.2.24"),
19);
ASSERT_TRUE(desc.option);
ASSERT_TRUE(desc.option_);
// This option should be set to "true", represented as 0x1 in the option
// buffer.
......@@ -2419,7 +2419,7 @@ TEST_F(Dhcp4ParserTest, stdOptionData) {
ASSERT_EQ(1, std::distance(range.first, range.second));
// The actual pointer to the option is held in the option field
// in the structure returned.
OptionPtr option = range.first->option;
OptionPtr option = range.first->option_;
ASSERT_TRUE(option);
// Option object returned for here is expected to be Option6IA
// which is derived from Option. This class is dedicated to
......@@ -2618,11 +2618,11 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
// Get the option.
OptionDescriptor desc =
subnet->getCfgOption()->get("dhcp4", DHO_VENDOR_ENCAPSULATED_OPTIONS);
EXPECT_TRUE(desc.option);
EXPECT_EQ(DHO_VENDOR_ENCAPSULATED_OPTIONS, desc.option->getType());
EXPECT_TRUE(desc.option_);
EXPECT_EQ(DHO_VENDOR_ENCAPSULATED_OPTIONS, desc.option_->getType());
// Option with the code 1 should be added as a sub-option.
OptionPtr option_foo = desc.option->getOption(1);
OptionPtr option_foo = desc.option_->getOption(1);
ASSERT_TRUE(option_foo);
EXPECT_EQ(1, option_foo->getType());
// This option comprises a single uint32_t value thus it is
......@@ -2635,7 +2635,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
EXPECT_EQ(1234, option_foo_uint32->getValue());
// Option with the code 2 should be added as a sub-option.
OptionPtr option_foo2 = desc.option->getOption(2);
OptionPtr option_foo2 = desc.option_->getOption(2);
ASSERT_TRUE(option_foo2);
EXPECT_EQ(2, option_foo2->getType());
// This option comprises the IPV4 address. Such option is
......@@ -2647,7 +2647,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
EXPECT_EQ("192.168.2.1", option_foo2_v4->readAddress().toText());
// Option with the code 3 should not be added.
EXPECT_FALSE(desc.option->getOption(3));
EXPECT_FALSE(desc.option_->getOption(3));
}
// This test checks if vendor options can be specified in the config file
......@@ -2696,17 +2696,17 @@ TEST_F(Dhcp4ParserTest, vendorOptionsHex) {
// Try to get the option from the vendor space 4491
OptionDescriptor desc1 = subnet->getCfgOption()->get(VENDOR_ID_CABLE_LABS, 100);
ASSERT_TRUE(desc1.option);
EXPECT_EQ(100, desc1.option->getType());
ASSERT_TRUE(desc1.option_);
EXPECT_EQ(100, desc1.option_->getType());
// Try to get the option from the vendor space 1234
OptionDescriptor desc2 = subnet->getCfgOption()->get(1234, 100);
ASSERT_TRUE(desc2.option);
EXPECT_EQ(100, desc1.option->getType());
ASSERT_TRUE(desc2.option_);
EXPECT_EQ(100, desc1.option_->getType());
// Try to get the non-existing option from the non-existing
// option space and expect that option is not returned.
OptionDescriptor desc3 = subnet->getCfgOption()->get(5678, 100);
ASSERT_FALSE(desc3.option);
ASSERT_FALSE(desc3.option_);
}
// This test checks if vendor options can be specified in the config file,
......@@ -2757,13 +2757,13 @@ TEST_F(Dhcp4ParserTest, vendorOptionsCsv) {
// Try to get the option from the vendor space 4491
OptionDescriptor desc1 = subnet->getCfgOption()->get(VENDOR_ID_CABLE_LABS, 100);
ASSERT_TRUE(desc1.option);
EXPECT_EQ(100, desc1.option->getType());
ASSERT_TRUE(desc1.option_);
EXPECT_EQ(100, desc1.option_->getType());
// Try to get the non-existing option from the non-existing
// option space and expect that option is not returned.
OptionDescriptor desc2 = subnet->getCfgOption()->get(5678, 100);
ASSERT_FALSE(desc2.option);
ASSERT_FALSE(desc2.option_);
}
......
......@@ -732,8 +732,8 @@ Dhcpv6Srv::appendRequestedOptions(const Pkt6Ptr& question, Pkt6Ptr& answer) {
const std::vector<uint16_t>& requested_opts = option_oro->getValues();
BOOST_FOREACH(uint16_t opt, requested_opts) {
OptionDescriptor desc = subnet->getCfgOption()->get("dhcp6", opt);
if (desc.option) {
answer->addOption(desc.option);
if (desc.option_) {
answer->addOption(desc.option_);
}
}
}
......@@ -778,8 +778,8 @@ Dhcpv6Srv::appendRequestedVendorOptions(const Pkt6Ptr& question, Pkt6Ptr& answer
const std::vector<uint16_t>& requested_opts = oro->getValues();
BOOST_FOREACH(uint16_t opt, requested_opts) {
OptionDescriptor desc = subnet->getCfgOption()->get(vendor_id, opt);
if (desc.option) {
vendor_rsp->addOption(desc.option);
if (desc.option_) {
vendor_rsp->addOption(desc.option_);
added = true;
}
}
......
......@@ -418,30 +418,30 @@ public:
size_t expected_data_len,
bool extra_data = false) {
// Check if option descriptor contains valid option pointer.
ASSERT_TRUE(option_desc.option);
ASSERT_TRUE(option_desc.option_);
// Verify option type.
EXPECT_EQ(expected_code, option_desc.option->getType());
EXPECT_EQ(expected_code, option_desc.option_->getType());
// We may have many different option types being created. Some of them
// have dedicated classes derived from Option class. In such case if
// we want to verify the option contents against expected_data we have
// to prepare raw buffer with the contents of the option. The easiest
// way is to call pack() which will prepare on-wire data.
util::OutputBuffer buf(option_desc.option->getData().size());
option_desc.option->pack(buf);
util::OutputBuffer buf(option_desc.option_->getData().size());
option_desc.option_->pack(buf);
if (extra_data) {
// The length of the buffer must be at least equal to size of the
// reference data but it can sometimes be greater than that. This is
// because some options carry suboptions that increase the overall
// length.
ASSERT_GE(buf.getLength() - option_desc.option->getHeaderLen(),
ASSERT_GE(buf.getLength() - option_desc.option_->getHeaderLen(),
expected_data_len);
} else {
ASSERT_EQ(buf.getLength() - option_desc.option->getHeaderLen(),
ASSERT_EQ(buf.getLength() - option_desc.option_->getHeaderLen(),
expected_data_len);
}
// Verify that the data is correct. Do not verify suboptions and a header.
const uint8_t* data = static_cast<const uint8_t*>(buf.getData());
EXPECT_EQ(0, memcmp(expected_data, data + option_desc.option->getHeaderLen(),
EXPECT_EQ(0, memcmp(expected_data, data + option_desc.option_->getHeaderLen(),
expected_data_len));
}
......@@ -475,7 +475,7 @@ public:
// The subnet should now hold one option with the specified code.
OptionDescriptor desc =
getOptionFromSubnet(IOAddress("2001:db8:1::5"), option_code);
ASSERT_TRUE(desc.option);
ASSERT_TRUE(desc.option_);
testOption(desc, option_code, expected_data, expected_data_len);
CfgMgr::instance().clear();
}
......@@ -2127,16 +2127,16 @@ TEST_F(Dhcp6ParserTest, optionDataTwoSpaces) {
ASSERT_TRUE(subnet);
// Try to get the option from the space dhcp6.
OptionDescriptor desc1 = subnet->getCfgOption()->get("dhcp6", 38);
ASSERT_TRUE(desc1.option);
EXPECT_EQ(38, desc1.option->getType());
ASSERT_TRUE(desc1.option_);
EXPECT_EQ(38, desc1.option_->getType());
// Try to get the option from the space isc.
OptionDescriptor desc2 = subnet->getCfgOption()->get("isc", 38);
ASSERT_TRUE(desc2.option);
EXPECT_EQ(38, desc1.option->getType());
ASSERT_TRUE(desc2.option_);
EXPECT_EQ(38, desc1.option_->getType());
// Try to get the non-existing option from the non-existing
// option space and expect that option is not returned.
OptionDescriptor desc3 = subnet->getCfgOption()->get("non-existing", 38);
ASSERT_FALSE(desc3.option);
ASSERT_FALSE(desc3.option_);
}
// The goal of this test is to verify that it is possible to
......@@ -2289,17 +2289,17 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
// Get the option.
OptionDescriptor desc = subnet->getCfgOption()->get("dhcp6", 100);
EXPECT_TRUE(desc.option);
EXPECT_EQ(100, desc.option->getType());
EXPECT_TRUE(desc.option_);
EXPECT_EQ(100, desc.option_->getType());
// This opton should comprise two sub-options.
// Onf of them is 'foo' with code 110.
OptionPtr option_foo = desc.option->getOption(110);
OptionPtr option_foo = desc.option_->getOption(110);
ASSERT_TRUE(option_foo);
EXPECT_EQ(110, option_foo->getType());
// ...another one 'foo2' with code 111.
OptionPtr option_foo2 = desc.option->getOption(111);
OptionPtr option_foo2 = desc.option_->getOption(111);
ASSERT_TRUE(option_foo2);
EXPECT_EQ(111, option_foo2->getType());
}
......@@ -2407,7 +2407,7 @@ TEST_F(Dhcp6ParserTest, optionDataBoolean) {
// The subnet should now hold one option with the code 1000.
OptionDescriptor desc =
getOptionFromSubnet(IOAddress("2001:db8:1::5"), 1000);
ASSERT_TRUE(desc.option);
ASSERT_TRUE(desc.option_);
// This option should be set to "true", represented as 0x1 in the option
// buffer.
......@@ -2600,7 +2600,7 @@ TEST_F(Dhcp6ParserTest, stdOptionData) {
ASSERT_EQ(1, std::distance(range.first, range.second));
// The actual pointer to the option is held in the option field
// in the structure returned.
OptionPtr option = range.first->option;
OptionPtr option = range.first->option_;
ASSERT_TRUE(option);
// Option object returned for here is expected to be Option6IA
// which is derived from Option. This class is dedicated to
......@@ -2665,17 +2665,17 @@ TEST_F(Dhcp6ParserTest, vendorOptionsHex) {
// Try to get the option from the vendor space 4491
OptionDescriptor desc1 = subnet->getCfgOption()->get(4491, 100);
ASSERT_TRUE(desc1.option);
EXPECT_EQ(100, desc1.option->getType());
ASSERT_TRUE(desc1.option_);
EXPECT_EQ(100, desc1.option_->getType());
// Try to get the option from the vendor space 1234
OptionDescriptor desc2 = subnet->getCfgOption()->get(1234, 100);
ASSERT_TRUE(desc2.option);
EXPECT_EQ(100, desc1.option->getType());
ASSERT_TRUE(desc2.option_);
EXPECT_EQ(100, desc1.option_->getType());
// Try to get the non-existing option from the non-existing
// option space and expect that option is not returned.
OptionDescriptor desc3 = subnet->getCfgOption()->get(5678, 38);
ASSERT_FALSE(desc3.option);
ASSERT_FALSE(desc3.option_);
}
// This test checks if vendor options can be specified in the config file,
......@@ -2727,13 +2727,13 @@ TEST_F(Dhcp6ParserTest, vendorOptionsCsv) {
// Try to get the option from the vendor space 4491
OptionDescriptor desc1 = subnet->getCfgOption()->get(4491, 100);
ASSERT_TRUE(desc1.option);
EXPECT_EQ(100, desc1.option->getType());
ASSERT_TRUE(desc1.option_);
EXPECT_EQ(100, desc1.option_->getType());
// Try to get the non-existing option from the non-existing
// option space and expect that option is not returned.
OptionDescriptor desc2 = subnet->getCfgOption()->get(5678, 100);
ASSERT_FALSE(desc2.option);
ASSERT_FALSE(desc2.option_);
}
/// @todo add tests similar to vendorOptionsCsv and vendorOptionsHex, but for
......@@ -2875,11 +2875,11 @@ TEST_F(Dhcp6ParserTest, DISABLED_stdOptionDataEncapsulate) {
// Get the option.
OptionDescriptor desc = subnet->getCfgOption()->get("dhcp6", D6O_VENDOR_OPTS);
EXPECT_TRUE(desc.option);
EXPECT_EQ(D6O_VENDOR_OPTS, desc.option->getType());
EXPECT_TRUE(desc.option_);
EXPECT_EQ(D6O_VENDOR_OPTS, desc.option_->getType());
// Option with the code 110 should be added as a sub-option.
OptionPtr option_foo = desc.option->getOption(110);
OptionPtr option_foo = desc.option_->getOption(110);
ASSERT_TRUE(option_foo);
EXPECT_EQ(110, option_foo->getType());
// This option comprises a single uint32_t value thus it is
......@@ -2892,7 +2892,7 @@ TEST_F(Dhcp6ParserTest, DISABLED_stdOptionDataEncapsulate) {
EXPECT_EQ(1234, option_foo_uint32->getValue());
// Option with the code 111 should be added as a sub-option.
OptionPtr option_foo2 = desc.option->getOption(111);
OptionPtr option_foo2 = desc.option_->getOption(111);
ASSERT_TRUE(option_foo2);
EXPECT_EQ(111, option_foo2->getType());
// This option comprises the IPV4 address. Such option is
......@@ -2904,7 +2904,7 @@ TEST_F(Dhcp6ParserTest, DISABLED_stdOptionDataEncapsulate) {
EXPECT_EQ("192.168.2.1", option_foo2_v4->readAddress().toText());
// Option with the code 112 should not be added.
EXPECT_FALSE(desc.option->getOption(112));
EXPECT_FALSE(desc.option_->getOption(112));
}
// Tests of the hooks libraries configuration. All tests have the pre-
......
......@@ -23,8 +23,8 @@ namespace dhcp {
bool
OptionDescriptor::equals(const OptionDescriptor& other) const {
return (persistent == other.persistent &&
option->equals(other.option));
return (persistent_ == other.persistent_ &&
option_->equals(other.option_));
}
bool
......@@ -82,14 +82,14 @@ CfgOption::encapsulateInternal(const std::string& option_space) {
OptionContainerPtr options = getAll(option_space);
for (OptionContainer::const_iterator opt = options->begin();
opt != options->end(); ++opt) {
const std::string& encap_space = opt->option->getEncapsulatedSpace();
const std::string& encap_space = opt->option_->getEncapsulatedSpace();
if (!encap_space.empty()) {
OptionContainerPtr encap_options = getAll(encap_space);
for (OptionContainer::const_iterator encap_opt =
encap_options->begin(); encap_opt != encap_options->end();
++encap_opt) {
if (!opt->option->getOption(encap_opt->option->getType())) {
opt->option->addOption(encap_opt->option);
if (!opt->option_->getOption(encap_opt->option_->getType())) {
opt->option_->addOption(encap_opt->option_);
}
}
}
......@@ -121,12 +121,12 @@ CfgOption::mergeInternal(const OptionSpaceContainer<OptionContainer,
src_opt != src_all->end(); ++src_opt) {
const OptionContainerTypeIndex& idx = dest_all->get<1>();
const OptionContainerTypeRange& range =
idx.equal_range(src_opt->option->getType());
idx.equal_range(src_opt->option_->getType());
// If there is no such option in the destination container,
// add one.
if (std::distance(range.first, range.second) == 0) {
dest_container.addItem(OptionDescriptor(src_opt->option,
src_opt->persistent),
dest_container.addItem(OptionDescriptor(src_opt->option_,
src_opt->persistent_),
*it);
}
}
......
......@@ -38,23 +38,23 @@ namespace dhcp {
/// (persistent = true).
struct OptionDescriptor {
/// Option instance.
OptionPtr option;
OptionPtr option_;
/// Persistent flag, if true option is always sent to the client,
/// if false option is sent to the client on request.
bool persistent;
bool persistent_;
/// @brief Constructor.
///
/// @param opt option
/// @param persist if true option is always sent.
OptionDescriptor(const OptionPtr& opt, bool persist)
: option(opt), persistent(persist) {};
: option_(opt), persistent_(persist) {};
/// @brief Constructor
///
/// @param persist if true option is always sent.
OptionDescriptor(bool persist)
: option(OptionPtr()), persistent(persist) {};
: option_(OptionPtr()), persistent_(persist) {};
/// @brief Checks if the one descriptor is equal to another.
///
......@@ -140,7 +140,7 @@ typedef boost::multi_index_container<
boost::multi_index::member<
OptionDescriptor,
OptionPtr,
&OptionDescriptor::option
&OptionDescriptor::option_
>
>
>,
......@@ -150,7 +150,7 @@ typedef boost::multi_index_container<
boost::multi_index::member<
OptionDescriptor,
bool,
&OptionDescriptor::persistent
&OptionDescriptor::persistent_
>
>
>
......
......@@ -327,13 +327,13 @@ OptionDataParser::build(ConstElementPtr option_data_entries) {
// Try to create the option instance.
createOption(option_data_entries);
if (!option_descriptor_.option) {
if (!option_descriptor_.option_) {
isc_throw(isc::InvalidOperation,
"parser logic error: no option has been configured and"
" thus there is nothing to commit. Has build() been called?");
}
cfg_->add(option_descriptor_.option, option_descriptor_.persistent,
cfg_->add(option_descriptor_.option_, option_descriptor_.persistent_,
option_space_);
}
......@@ -516,8 +516,8 @@ OptionDataParser::createOption(ConstElementPtr option_data) {
// until the commit stage when it is inserted into the main storage.
// If an option with the same code exists in main storage already the
// old option is replaced.
option_descriptor_.option = option;
option_descriptor_.persistent = false;
option_descriptor_.option_ = option;
option_descriptor_.persistent_ = false;
} else {
// Option name should match the definition. The option name
......@@ -540,8 +540,8 @@ OptionDataParser::createOption(ConstElementPtr option_data) {
def->optionFactory(universe, code, data_tokens) :
def->optionFactory(universe, code, binary);
OptionDescriptor desc(option, false);
option_descriptor_.option = option;
option_descriptor_.persistent = false;
option_descriptor_.option_ = option;
option_descriptor_.persistent_ = false;
} catch (const isc::Exception& ex) {
isc_throw(DhcpConfigError, "option data does not match"
......
......@@ -106,8 +106,8 @@ TEST(CfgOptionTest, add) {
uint16_t expected_code = 100;
for (OptionContainer::const_iterator option_desc = options->begin();
option_desc != options->end(); ++option_desc) {
ASSERT_TRUE(option_desc->option);
EXPECT_EQ(expected_code, option_desc->option->getType());
ASSERT_TRUE(option_desc->option_);
EXPECT_EQ(expected_code, option_desc->option_->getType());
++expected_code;
}
......@@ -119,8 +119,8 @@ TEST(CfgOptionTest, add) {
expected_code = 105;
for (OptionContainer::const_iterator option_desc = options->begin();
option_desc != options->end(); ++option_desc) {
ASSERT_TRUE(option_desc->option);
EXPECT_EQ(expected_code, option_desc->option->getType());
ASSERT_TRUE(option_desc->option_);
EXPECT_EQ(expected_code, option_desc->option_->getType());
++expected_code;
}
......@@ -174,32 +174,32 @@ TEST(CfgOption, merge) {
// Validate the options in the dhcp6 option space in the destination.
for (uint16_t code = 100; code < 110; ++code) {
OptionDescriptor desc = cfg_dst.get("dhcp6", code);
ASSERT_TRUE(desc.option);
ASSERT_EQ(1, desc.option->getData().size());
ASSERT_TRUE(desc.option_);
ASSERT_EQ(1, desc.option_->getData().size());
// The options with even option codes should hold one byte of data
// equal to 0x1. These are the ones that we have initially added to
// the destination configuration. The other options should hold the
// values of 0xFF which indicates that they have been merged from the
// source configuration.
if ((code % 2) == 0) {
EXPECT_EQ(0x01, desc.option->getData()[0]);
EXPECT_EQ(0x01, desc.option_->getData()[0]);
} else {
EXPECT_EQ(0xFF, desc.option->getData()[0]);
EXPECT_EQ(0xFF, desc.option_->getData()[0]);
}
}
// Validate the options in the vendor space.
for (uint16_t code = 100; code < 110; ++code) {
OptionDescriptor desc = cfg_dst.get(123, code);
ASSERT_TRUE(desc.option);
ASSERT_EQ(1, desc.option->getData().size());