const Triplet<uint32_t>& preferred_lifetime,
const Triplet<uint32_t>& valid_lifetime,
const SubnetID id)
-:Subnet(prefix, length, t1, t2, valid_lifetime, RelayInfo(IOAddress("::")), id),
- preferred_(preferred_lifetime) {
+ :Subnet(prefix, length, t1, t2, valid_lifetime, RelayInfo(IOAddress("::")), id),
+ preferred_(preferred_lifetime), rapid_commit_(false) {
if (!prefix.isV6()) {
isc_throw(BadValue, "Non IPv6 prefix " << prefix
<< " specified in subnet6");
return interface_id_;
}
-protected:
+ /// @brief Enables or disables Rapid Commit option support for the subnet.
+ ///
+ /// @param rapid_commit A boolean value indicating that the Rapid Commit
+ /// option support is enabled (if true), or disabled (if false).
+ void setRapidCommit(const bool rapid_commit) {
+ rapid_commit_ = rapid_commit;
+ };
+
+ /// @brief Returns boolean value indicating that the Rapid Commit option
+ /// is supported or unsupported for the subnet.
+ ///
+ /// @return true if the Rapid Commit option is supported, false otherwise.
+ bool getRapidCommit() const {
+ return (rapid_commit_);
+ }
+
+private:
/// @brief Returns default address for pool selection
/// @return ANY IPv6 address
/// @brief a triplet with preferred lifetime (in seconds)
Triplet<uint32_t> preferred_;
+
+ /// @brief A flag indicating if Rapid Commit option is supported
+ /// for this subnet.
+ bool rapid_commit_;
};
/// @brief A pointer to a Subnet6 object
}
+// This test checks that the Rapid Commit support can be enabled or
+// disabled for a subnet. It also checks that the Rapid Commit is
+// support is disabled by default.
+TEST(Subnet6Test, rapidCommit) {
+ Subnet6 subnet(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+
+ // By default, the RC should be disabled.
+ EXPECT_FALSE(subnet.getRapidCommit());
+
+ // Enable Rapid Commit.
+ subnet.setRapidCommit(true);
+ EXPECT_TRUE(subnet.getRapidCommit());
+
+ // Disable again.
+ subnet.setRapidCommit(false);
+ EXPECT_FALSE(subnet.getRapidCommit());
+}
+
// Checks if last allocated address/prefix is stored/retrieved properly
TEST(Subnet6Test, lastAllocated) {
IOAddress ia("2001:db8:1::1");