Browse Source

[3171] Changes after review:

 - non-const getPools() renamed to getPoolsWritable()
 - docs update
Tomek Mrugalski 11 years ago
parent
commit
15c8b6ac63
3 changed files with 15 additions and 13 deletions
  1. 4 2
      src/lib/dhcpsrv/libdhcpsrv.dox
  2. 3 3
      src/lib/dhcpsrv/subnet.cc
  3. 8 8
      src/lib/dhcpsrv/subnet.h

+ 4 - 2
src/lib/dhcpsrv/libdhcpsrv.dox

@@ -99,14 +99,16 @@ returning clients are almost guaranteed to get a different address. Another
 drawback is that with almost depleted pools it is increasingly difficult to
 drawback is that with almost depleted pools it is increasingly difficult to
 "guess" an address that is free. This allocator is currently not implemented.
 "guess" an address that is free. This allocator is currently not implemented.
 
 
-@subsection allocEnginePD Prefix Delegation support in AllocEngine
+@subsection allocEngineTypes Different lease types support
 
 
 Allocation Engine has been extended to support different types of leases. Four
 Allocation Engine has been extended to support different types of leases. Four
 types are supported: TYPE_V4 (IPv4 addresses), TYPE_NA (normal IPv6 addresses),
 types are supported: TYPE_V4 (IPv4 addresses), TYPE_NA (normal IPv6 addresses),
 TYPE_TA (temporary IPv6 addresses) and TYPE_PD (delegated prefixes). Support for
 TYPE_TA (temporary IPv6 addresses) and TYPE_PD (delegated prefixes). Support for
 TYPE_TA is partial. Some routines are able to handle it, while other are
 TYPE_TA is partial. Some routines are able to handle it, while other are
 not. The major missing piece is the RandomAllocator, so there is no way to randomly
 not. The major missing piece is the RandomAllocator, so there is no way to randomly
-generate an address. This defeats the purpose of using temporary addresses.
+generate an address. This defeats the purpose of using temporary addresses for now.
+
+@subsection allocEnginePD Prefix Delegation support in AllocEngine
 
 
 The Allocation Engine supports allocation of the IPv6 addresses and prefixes.
 The Allocation Engine supports allocation of the IPv6 addresses and prefixes.
 For a prefix pool, the iterative allocator "walks over"
 For a prefix pool, the iterative allocator "walks over"

+ 3 - 3
src/lib/dhcpsrv/subnet.cc

@@ -169,7 +169,7 @@ const PoolCollection& Subnet::getPools(Lease::Type type) const {
     }
     }
 }
 }
 
 
-PoolCollection& Subnet::getPools(Lease::Type type) {
+PoolCollection& Subnet::getPoolsWritable(Lease::Type type) {
     // check if the type is valid (and throw if it isn't)
     // check if the type is valid (and throw if it isn't)
     checkType(type);
     checkType(type);
 
 
@@ -230,12 +230,12 @@ Subnet::addPool(const PoolPtr& pool) {
     checkType(pool->getType());
     checkType(pool->getType());
 
 
     // Add the pool to the appropriate pools collection
     // Add the pool to the appropriate pools collection
-    getPools(pool->getType()).push_back(pool);
+    getPoolsWritable(pool->getType()).push_back(pool);
 }
 }
 
 
 void
 void
 Subnet::delPools(Lease::Type type) {
 Subnet::delPools(Lease::Type type) {
-    getPools(type).clear();
+    getPoolsWritable(type).clear();
 }
 }
 
 
 void
 void

+ 8 - 8
src/lib/dhcpsrv/subnet.h

@@ -319,14 +319,6 @@ public:
     /// @return a collection of all pools
     /// @return a collection of all pools
     const PoolCollection& getPools(Lease::Type type) const;
     const PoolCollection& getPools(Lease::Type type) const;
 
 
-    /// @brief Returns all pools (variable variant)
-    ///
-    /// The reference is only valid as long as the object that returned it.
-    ///
-    /// @param type lease type to be set
-    /// @return a collection of all pools
-    PoolCollection& getPools(Lease::Type type);
-
     /// @brief Sets name of the network interface for directly attached networks
     /// @brief Sets name of the network interface for directly attached networks
     ///
     ///
     /// @param iface_name name of the interface
     /// @param iface_name name of the interface
@@ -344,6 +336,14 @@ public:
     virtual std::string toText() const;
     virtual std::string toText() const;
 
 
 protected:
 protected:
+    /// @brief Returns all pools (non-const variant)
+    ///
+    /// The reference is only valid as long as the object that returned it.
+    ///
+    /// @param type lease type to be set
+    /// @return a collection of all pools
+    PoolCollection& getPoolsWritable(Lease::Type type);
+
     /// @brief Protected constructor
     /// @brief Protected constructor
     //
     //
     /// By making the constructor protected, we make sure that noone will
     /// By making the constructor protected, we make sure that noone will