- getters/setters implemented in Cfg4o6.
- extra space removed.
// Try 4o6 specific parameter: 4o6-interface
try {
string iface4o6 = string_values_->getParam("4o6-interface");
- subnet4->get4o6().iface4o6_ = iface4o6;
- subnet4->get4o6().enabled_ = true;
+ subnet4->get4o6().setIface4o6(iface4o6);
+ subnet4->get4o6().enabled(true);
} catch (const DhcpConfigError&) {
// Don't care. 4o6-subnet is optional.
}
isc_throw(DhcpConfigError, "Invalid prefix length specified in "
"4o6-subnet parameter: " + subnet4o6 + ", expected 0..128 value");
}
- subnet4->get4o6().subnet4o6_ = make_pair(IOAddress(prefix), len);
- subnet4->get4o6().enabled_ = true;
+ subnet4->get4o6().setSubnet4o6(IOAddress(prefix), len);
+ subnet4->get4o6().enabled(true);
} catch (const DhcpConfigError&) {
// Don't care. 4o6-subnet is optional.
}
std::string ifaceid = string_values_->getParam("4o6-interface-id");
OptionBuffer tmp(ifaceid.begin(), ifaceid.end());
OptionPtr opt(new Option(Option::V6, D6O_INTERFACE_ID, tmp));
- subnet4->get4o6().interface_id_ = opt;
- subnet4->get4o6().enabled_ = true;
+ subnet4->get4o6().setInterfaceId(opt);
+ subnet4->get4o6().enabled(true);
} catch (const DhcpConfigError&) {
}
ASSERT_TRUE(subnet);
Cfg4o6& dhcp4o6 = subnet->get4o6();
- EXPECT_FALSE(dhcp4o6.enabled_);
+ EXPECT_FALSE(dhcp4o6.enabled());
}
// Checks if the DHCPv4 is able to parse the configuration with 4o6 subnet
ASSERT_TRUE(subnet);
Cfg4o6& dhcp4o6 = subnet->get4o6();
- EXPECT_TRUE(dhcp4o6.enabled_);
- EXPECT_EQ(IOAddress("2001:db8::123"), dhcp4o6.subnet4o6_.first);
- EXPECT_EQ(45, dhcp4o6.subnet4o6_.second);
+ EXPECT_TRUE(dhcp4o6.enabled());
+ EXPECT_EQ(IOAddress("2001:db8::123"), dhcp4o6.getSubnet4o6().first);
+ EXPECT_EQ(45, dhcp4o6.getSubnet4o6().second);
}
// Checks if the DHCPv4 is able to parse the configuration with 4o6 network
ASSERT_TRUE(subnet);
Cfg4o6& dhcp4o6 = subnet->get4o6();
- EXPECT_TRUE(dhcp4o6.enabled_);
- EXPECT_EQ("ethX", dhcp4o6.iface4o6_);
+ EXPECT_TRUE(dhcp4o6.enabled());
+ EXPECT_EQ("ethX", dhcp4o6.getIface4o6());
}
// Checks if the DHCPv4 is able to parse the configuration with both 4o6 network
// ... and that subnet has 4o6 network interface specified.
Cfg4o6& dhcp4o6 = subnet->get4o6();
- EXPECT_TRUE(dhcp4o6.enabled_);
- EXPECT_EQ(IOAddress("2001:db8::543"), dhcp4o6.subnet4o6_.first);
- EXPECT_EQ(21, dhcp4o6.subnet4o6_.second);
- EXPECT_EQ("ethX", dhcp4o6.iface4o6_);
+ EXPECT_TRUE(dhcp4o6.enabled());
+ EXPECT_EQ(IOAddress("2001:db8::543"), dhcp4o6.getSubnet4o6().first);
+ EXPECT_EQ(21, dhcp4o6.getSubnet4o6().second);
+ EXPECT_EQ("ethX", dhcp4o6.getIface4o6());
}
// Checks if the DHCPv4 is able to parse the configuration with 4o6 network
ASSERT_TRUE(subnet);
Cfg4o6& dhcp4o6 = subnet->get4o6();
- EXPECT_TRUE(dhcp4o6.enabled_);
- OptionPtr ifaceid = dhcp4o6.interface_id_;
+ EXPECT_TRUE(dhcp4o6.enabled());
+ OptionPtr ifaceid = dhcp4o6.getInterfaceId();
ASSERT_TRUE(ifaceid);
vector<uint8_t> data = ifaceid->getData();
:enabled_(false), subnet4o6_(std::make_pair(asiolink::IOAddress("::"), 128u)) {
}
+ /// @brief Returns whether the DHCP4o6 is enabled or not.
+ /// @return true if enabled
+ bool enabled() const {
+ return (enabled_);
+ }
+
+ /// @brief Sets the DHCP4o6 enabled status.
+ /// @param enabled specifies if the DHCP4o6 should be enabled or not
+ void enabled(bool enabled) {
+ enabled_ = enabled;
+ }
+
+ /// @brief Returns the DHCP4o6 interface.
+ /// @return value of the 4o6-interface parameter.
+ std::string getIface4o6() const {
+ return (iface4o6_);
+ }
+
+ /// @brief Sets the 4o6-interface.
+ /// @param iface name of the network interface the 4o6 traffic is received on
+ void setIface4o6(const std::string& iface) {
+ iface4o6_ = iface;
+ }
+
+ /// @brief Returns prefix/len for the IPv6 subnet.
+ /// @return prefix/length pair
+ std::pair<asiolink::IOAddress, uint8_t> getSubnet4o6() const {
+ return (subnet4o6_);
+ }
+
+ /// @brief Sets the prefix/length information (content of the 4o6-subnet).
+ /// @param subnet IOAddress that represents a prefix
+ /// @param prefix specifies prefix length
+ void setSubnet4o6(const asiolink::IOAddress& subnet, uint8_t prefix) {
+ subnet4o6_ = std::make_pair(subnet, prefix);
+ }
+
+ /// @brief Returns the interface-id.
+ /// @return the option representing interface-id (or NULL)
+ OptionPtr getInterfaceId() const {
+ return (interface_id_);
+ }
+
+ /// @brief Sets the interface-id
+ /// @param opt option to be used as interface-id match
+ void setInterfaceId(const OptionPtr& opt) {
+ interface_id_ = opt;
+ }
+
+private:
+
/// Specifies if 4o6 is enabled on this subnet.
bool enabled_;
/// lookup.
bool match_client_id_;
-
/// @brief All the information related to DHCP4o6
Cfg4o6 dhcp4o6_;
};