diff options
author | Marcin Siodelski <marcin@isc.org> | 2018-09-25 10:50:13 +0200 |
---|---|---|
committer | Marcin Siodelski <marcin@isc.org> | 2018-10-08 16:39:22 +0200 |
commit | 3ef5938626712225e3302b8e663211462953b7f1 (patch) | |
tree | e13ae39fe277838997dd9e54ae32a5190b7fd9c3 /src/lib/dhcpsrv/subnet.h | |
parent | [#93,!35] Extended MySqlConnection with generic query functions. (diff) | |
download | kea-3ef5938626712225e3302b8e663211462953b7f1.tar.xz kea-3ef5938626712225e3302b8e663211462953b7f1.zip |
[#93,!35] Implemented subnet fetching in MySQL Config Backend.
Diffstat (limited to 'src/lib/dhcpsrv/subnet.h')
-rw-r--r-- | src/lib/dhcpsrv/subnet.h | 27 |
1 files changed, 27 insertions, 0 deletions
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 <boost/date_time/posix_time/posix_time.hpp> #include <boost/pointer_cast.hpp> #include <boost/shared_ptr.hpp> +#include <cstdint> #include <map> +#include <utility> 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<asiolink::IOAddress, uint8_t> + 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<asiolink::IOAddress, uint8_t> + 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<asiolink::IOAddress, uint8_t> + parsePrefix(const std::string& prefix); + private: /// @brief Returns default address for pool selection |