diff options
Diffstat (limited to 'src/lib/dhcpsrv/cfg_subnets4.h')
-rw-r--r-- | src/lib/dhcpsrv/cfg_subnets4.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/cfg_subnets4.h b/src/lib/dhcpsrv/cfg_subnets4.h index a065ddc7a5..5c0d31bcff 100644 --- a/src/lib/dhcpsrv/cfg_subnets4.h +++ b/src/lib/dhcpsrv/cfg_subnets4.h @@ -10,8 +10,10 @@ #include <asiolink/io_address.h> #include <cc/cfg_to_element.h> #include <dhcpsrv/subnet.h> +#include <dhcpsrv/subnet_id.h> #include <dhcpsrv/subnet_selector.h> #include <boost/shared_ptr.hpp> +#include <string> namespace isc { namespace dhcp { @@ -48,6 +50,40 @@ public: return (&subnets_); } + /// @brief Returns const pointer to a subnet identified by the specified + /// subnet identifier. + /// + /// The const pointer is returned by this method to prevent a caller from + /// modifying the subnet configuration. Modifications to subnet configuration + /// is dangerous and must be done carefully. The subnets' configruation is + /// held in the multi index container and any modifications to the subnet + /// id or subnet prefix must trigger re-indexing of multi index container. + /// There is no possibility to enforce this when the non-const pointer is + /// returned. + /// + /// @param subnet_id Subnet identifier. + /// + /// @return Pointer to the @c Subnet4 object or null pointer if such + /// subnet doesn't exist. + ConstSubnet4Ptr getBySubnetId(const SubnetID& subnet_id) const; + + /// @brief Returns const pointer to a subnet which matches the specified + /// prefix in the canonical form. + /// + /// The const pointer is returned by this method to prevent a caller from + /// modifying the subnet configuration. Modifications to subnet configuration + /// is dangerous and must be done carefully. The subnets' configruation is + /// held in the multi index container and any modifications to the subnet + /// id or subnet prefix must trigger re-indexing of multi index container. + /// There is no possibility to enforce this when the non-const pointer is + /// returned. + /// + /// @param subnet_prefix Subnet prefix, e.g. 10.2.3.0/24 + /// + /// @return Pointer to the @c Subnet4 object or null pointer if such + /// subnet doesn't exist. + ConstSubnet4Ptr getByPrefix(const std::string& subnet_prefix) const; + /// @brief Returns a pointer to the selected subnet. /// /// This method tries to retrieve the subnet for the client using various |