Browse Source

[3562] Use CfgHosts object in the SrvConfig.

Marcin Siodelski 10 years ago
parent
commit
cd1db81f9c
3 changed files with 36 additions and 2 deletions
  1. 11 0
      src/lib/dhcpsrv/cfg_hosts.h
  2. 2 2
      src/lib/dhcpsrv/srv_config.cc
  3. 23 0
      src/lib/dhcpsrv/srv_config.h

+ 11 - 0
src/lib/dhcpsrv/cfg_hosts.h

@@ -22,6 +22,7 @@
 #include <dhcpsrv/host.h>
 #include <dhcpsrv/host_container.h>
 #include <dhcpsrv/subnet_id.h>
+#include <boost/shared_ptr.hpp>
 #include <vector>
 
 namespace isc {
@@ -235,6 +236,16 @@ private:
 
 };
 
+/// @name Pointers to the @c CfgHosts objects.
+//@{
+/// @brief Non-const pointer.
+typedef boost::shared_ptr<CfgHosts> CfgHostsPtr;
+
+/// @brief Const pointer.
+typedef boost::shared_ptr<const CfgHosts> ConstCfgHostsPtr;
+
+//@}
+
 }
 }
 

+ 2 - 2
src/lib/dhcpsrv/srv_config.cc

@@ -26,12 +26,12 @@ namespace dhcp {
 
 SrvConfig::SrvConfig()
     : sequence_(0), cfg_option_def_(new CfgOptionDef()),
-      cfg_option_(new CfgOption()) {
+      cfg_option_(new CfgOption()), cfg_hosts_(new CfgHosts()) {
 }
 
 SrvConfig::SrvConfig(const uint32_t sequence)
     : sequence_(sequence), cfg_option_def_(new CfgOptionDef()),
-      cfg_option_(new CfgOption()) {
+      cfg_option_(new CfgOption()), cfg_hosts_(new CfgHosts()) {
 }
 
 std::string

+ 23 - 0
src/lib/dhcpsrv/srv_config.h

@@ -15,6 +15,7 @@
 #ifndef DHCPSRV_CONFIG_H
 #define DHCPSRV_CONFIG_H
 
+#include <dhcpsrv/cfg_hosts.h>
 #include <dhcpsrv/cfg_iface.h>
 #include <dhcpsrv/cfg_option.h>
 #include <dhcpsrv/cfg_option_def.h>
@@ -184,6 +185,22 @@ public:
         return (cfg_option_);
     }
 
+    /// @brief Returns pointer to the non-const objects representing host
+    /// reservations for different IPv4 and IPv6 subnets.
+    ///
+    /// @return Pointer to the non-const object holding host reservations.
+    CfgHostsPtr getCfgHosts() {
+        return (cfg_hosts_);
+    }
+
+    /// @brief Returns pointer to the const objects representing host
+    /// reservations for different IPv4 and IPv6 subnets.
+    ///
+    /// @return Pointer to the const object holding host reservations.
+    ConstCfgHostsPtr getCfgHosts() const {
+        return (cfg_hosts_);
+    }
+
     //@}
 
     /// @brief Copies the currnet configuration to a new configuration.
@@ -277,6 +294,12 @@ private:
     /// connected to any subnet.
     CfgOptionPtr cfg_option_;
 
+    /// @brief Pointer to the configuration for hosts reservation.
+    ///
+    /// This object holds a list of @c Host objects representing host
+    /// reservations for different IPv4 and IPv6 subnets.
+    CfgHostsPtr cfg_hosts_;
+
 };
 
 /// @name Pointers to the @c SrvConfig object.