From 3ef5938626712225e3302b8e663211462953b7f1 Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Tue, 25 Sep 2018 10:50:13 +0200 Subject: [#93,!35] Implemented subnet fetching in MySQL Config Backend. --- src/lib/dhcpsrv/subnet.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/lib/dhcpsrv/subnet.h') diff --git a/src/lib/dhcpsrv/subnet.h b/src/lib/dhcpsrv/subnet.h index e995283e35..25af5ddeed 100644 --- a/src/lib/dhcpsrv/subnet.h +++ b/src/lib/dhcpsrv/subnet.h @@ -25,7 +25,9 @@ #include #include #include +#include #include +#include namespace isc { namespace dhcp { @@ -359,6 +361,17 @@ protected: /// @return A pointer to unparsed subnet configuration. virtual data::ElementPtr toElement() const; + /// @brief Converts subnet prefix to a pair of prefix/length pair. + /// + /// IPv4 and IPv6 specific conversion functions should apply extra checks + /// on the returned values, i.e. whether length is in range and the IP + /// address has a valid type. + /// + /// @param prefix Prefix to be parsed. + /// @throw BadValue if provided prefix is not valid. + static std::pair + parsePrefixCommon(const std::string& prefix); + /// @brief subnet-id /// /// Subnet-id is a unique value that can be used to find or identify @@ -545,6 +558,13 @@ public: /// @return A pointer to unparsed subnet configuration. virtual data::ElementPtr toElement() const; + /// @brief Converts subnet prefix to a pair of prefix/length pair. + /// + /// @param prefix Prefix to be parsed. + /// @throw BadValue if provided invalid IPv4 prefix. + static std::pair + parsePrefix(const std::string& prefix); + private: /// @brief Returns default address for pool selection @@ -657,6 +677,13 @@ public: /// @return A pointer to unparsed subnet configuration. virtual data::ElementPtr toElement() const; + /// @brief Converts subnet prefix to a pair of prefix/length pair. + /// + /// @param prefix Prefix to be parsed. + /// @throw BadValue if provided invalid IPv4 prefix. + static std::pair + parsePrefix(const std::string& prefix); + private: /// @brief Returns default address for pool selection -- cgit v1.2.3