subnets_.push_back(subnet);
}
+Subnet4Ptr
+CfgSubnets4::replace(const Subnet4Ptr& subnet) {
+ // Get the subnet with the same ID.
+ const SubnetID& subnet_id = subnet->getID();
+ auto& index = subnets_.template get<SubnetSubnetIdIndexTag>();
+ auto subnet_it = index.find(subnet_id);
+ if (subnet_it == index.end()) {
+ isc_throw(BadValue, "ID of the IPv4 subnet '" << subnet_id
+ << "' is not in use");
+ }
+ bool ret = index.replace(subnet_it, subnet);
+
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_UPDATE_SUBNET4)
+ .arg(subnet_id).arg(ret);
+ if (ret) {
+ return (*subnet_it);
+ } else {
+ return (Subnet4Ptr());
+ }
+}
+
void
CfgSubnets4::del(const ConstSubnet4Ptr& subnet) {
del(subnet->getID());
/// duplicates id of an existing subnet.
void add(const Subnet4Ptr& subnet);
+ /// @brief Replaces subnet in the configuration.
+ ///
+ /// This method replaces a subnet by another subnet with the same ID.
+ /// The prefix should be the same too.
+ ///
+ /// @param subnet Pointer to the subnet being updated.
+ /// @throw BadValue if the subnet to update does not exit.
+ /// @return Pointer to the replaced subnet or NULL if it failed.
+ Subnet4Ptr replace(const Subnet4Ptr& subnet);
+
/// @brief Removes subnet from the configuration.
///
/// @param subnet Pointer to the subnet to be removed.
subnets_.push_back(subnet);
}
+Subnet6Ptr
+CfgSubnets6::replace(const Subnet6Ptr& subnet) {
+ // Get the subnet with the same ID.
+ const SubnetID& subnet_id = subnet->getID();
+ auto& index = subnets_.template get<SubnetSubnetIdIndexTag>();
+ auto subnet_it = index.find(subnet_id);
+ if (subnet_it == index.end()) {
+ isc_throw(BadValue, "ID of the IPv6 subnet '" << subnet_id
+ << "' is not in use");
+ }
+ bool ret = index.replace(subnet_it, subnet);
+
+ LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE, DHCPSRV_CFGMGR_UPDATE_SUBNET6)
+ .arg(subnet_id).arg(ret);
+ if (ret) {
+ return (*subnet_it);
+ } else {
+ return (Subnet6Ptr());
+ }
+}
+
void
CfgSubnets6::del(const ConstSubnet6Ptr& subnet) {
del(subnet->getID());
/// duplicates id of an existing subnet.
void add(const Subnet6Ptr& subnet);
+ /// @brief Replaces subnet in the configuration.
+ ///
+ /// This method replaces a subnet by another subnet with the same ID.
+ /// The prefix should be the same too.
+ ///
+ /// @param subnet Pointer to the subnet being updated.
+ /// @throw BadValue if the subnet to update does not exit.
+ /// @return Pointer to the replaced subnet or NULL if it failed.
+ Subnet6Ptr replace(const Subnet6Ptr& subnet);
+
/// @brief Removes subnet from the configuration.
///
/// @param subnet Pointer to the subnet to be removed.
The server will still honor the value but users are encouraged to
move to the new list parameter.
+% DHCPSRV_CFGMGR_UPDATE_SUBNET4 updating subnet %1 (result %2)
+A debug message reported when the DHCP configuration manager is updating the
+specified IPv4 subnet to its database. Subnet ID and result (expected to
+be true) are displayed.
+
+% DHCPSRV_CFGMGR_UPDATE_SUBNET6 updating subnet %1 (result %2)
+A debug message reported when the DHCP configuration manager is replacing the
+specified IPv6 subnet to its database. Subnet ID and result (expected to
+be true) are displayed.
+
% DHCPSRV_CFGMGR_SOCKET_RAW_UNSUPPORTED use of raw sockets is unsupported on this OS, UDP sockets will be used
This warning message is logged when the user specified that the
DHCPv4 server should use the raw sockets to receive the DHCP