summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/pool.h
diff options
context:
space:
mode:
authorTomek Mrugalski <tomasz@isc.org>2015-02-17 16:37:34 +0100
committerTomek Mrugalski <tomasz@isc.org>2015-02-17 16:37:34 +0100
commit303c0d3e63628f0420bde8e25d2277fb6ec64ce4 (patch)
tree20bc2596955434461de7b918e6190eb7751f5e4c /src/lib/dhcpsrv/pool.h
parent[3711] addrInRange, prefixesInRange implemented. (diff)
downloadkea-303c0d3e63628f0420bde8e25d2277fb6ec64ce4.tar.xz
kea-303c0d3e63628f0420bde8e25d2277fb6ec64ce4.zip
[3711] Pools now store maximum possible leases count.
Diffstat (limited to 'src/lib/dhcpsrv/pool.h')
-rw-r--r--src/lib/dhcpsrv/pool.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/pool.h b/src/lib/dhcpsrv/pool.h
index ae8cb58e69..388032db16 100644
--- a/src/lib/dhcpsrv/pool.h
+++ b/src/lib/dhcpsrv/pool.h
@@ -79,6 +79,14 @@ public:
virtual ~Pool() {
}
+ /// @brief Returns the number of all leases in this pool.
+ ///
+ /// Note that this is the upper bound, assuming that no leases are used
+ /// and there are no host reservations. This is just a theoretical calculation.
+ /// @return number of possible leases in this pool
+ uint64_t getLeasesCount() const {
+ return (leases_count_);
+ }
protected:
/// @brief protected constructor
@@ -120,6 +128,14 @@ protected:
/// @brief defines a lease type that will be served from this pool
Lease::Type type_;
+
+ /// @brief Stores number of possible leases.
+ ///
+ /// This could be calculated on the fly, but the calculations are somewhat
+ /// involved, so it is more efficient to calculate it once and just store
+ /// the result. Note that for very large pools, the number is capped at
+ /// max value of uint64_t.
+ uint64_t leases_count_;
};
/// @brief Pool information for IPv4 addresses