|
@@ -13,7 +13,6 @@
|
|
|
#include <dhcp/classify.h>
|
|
|
#include <dhcpsrv/d2_client_mgr.h>
|
|
|
#include <dhcpsrv/pool.h>
|
|
|
-#include <dhcpsrv/subnet.h>
|
|
|
#include <dhcpsrv/srv_config.h>
|
|
|
#include <util/buffer.h>
|
|
|
|
|
@@ -41,12 +40,9 @@ public:
|
|
|
/// @brief Configuration Manager
|
|
|
///
|
|
|
/// This singleton class holds the whole configuration for DHCPv4 and DHCPv6
|
|
|
-/// servers. It currently holds information about zero or more subnets6.
|
|
|
-/// Each subnet may contain zero or more pools. Pool4 and Pool6 is the most
|
|
|
-/// basic "chunk" of configuration. It contains a range of assignable
|
|
|
-/// addresses.
|
|
|
+/// servers.
|
|
|
///
|
|
|
-/// Below is a sketch of configuration inheritance (not implemented yet).
|
|
|
+/// Below is a sketch of configuration inheritance.
|
|
|
/// Let's investigate the following configuration:
|
|
|
///
|
|
|
/// @code
|
|
@@ -67,13 +63,9 @@ public:
|
|
|
/// and a valid lifetime of 1000s. The second subnet has preferred lifetime
|
|
|
/// of 500s, but valid lifetime of 2000s.
|
|
|
///
|
|
|
-/// Parameter inheritance is likely to be implemented in configuration handling
|
|
|
-/// routines, so there is no storage capability in a global scope for
|
|
|
-/// subnet-specific parameters.
|
|
|
-///
|
|
|
-/// @todo: Implement Subnet4 support (ticket #2237)
|
|
|
-/// @todo: Implement option definition support
|
|
|
-/// @todo: Implement parameter inheritance
|
|
|
+/// Parameter inheritance is implemented in dedicated classes. See
|
|
|
+/// @ref isc::dhcp::SimpleParser4::deriveParameters and
|
|
|
+/// @ref isc::dhcp::SimpleParser6::deriveParameters.
|
|
|
class CfgMgr : public boost::noncopyable {
|
|
|
public:
|
|
|
|
|
@@ -88,36 +80,6 @@ public:
|
|
|
/// accessing it.
|
|
|
static CfgMgr& instance();
|
|
|
|
|
|
- /// @brief Adds new DHCPv4 option space to the collection.
|
|
|
- ///
|
|
|
- /// @param space option space to be added.
|
|
|
- ///
|
|
|
- /// @throw isc::dhcp::InvalidOptionSpace invalid option space
|
|
|
- /// has been specified.
|
|
|
- void addOptionSpace4(const OptionSpacePtr& space);
|
|
|
-
|
|
|
- /// @brief Adds new DHCPv6 option space to the collection.
|
|
|
- ///
|
|
|
- /// @param space option space to be added.
|
|
|
- ///
|
|
|
- /// @throw isc::dhcp::InvalidOptionSpace invalid option space
|
|
|
- /// has been specified.
|
|
|
- void addOptionSpace6(const OptionSpacePtr& space);
|
|
|
-
|
|
|
- /// @brief Return option spaces for DHCPv4.
|
|
|
- ///
|
|
|
- /// @return A collection of option spaces.
|
|
|
- const OptionSpaceCollection& getOptionSpaces4() const {
|
|
|
- return (spaces4_);
|
|
|
- }
|
|
|
-
|
|
|
- /// @brief Return option spaces for DHCPv6.
|
|
|
- ///
|
|
|
- /// @return A collection of option spaces.
|
|
|
- const OptionSpaceCollection& getOptionSpaces6() const {
|
|
|
- return (spaces6_);
|
|
|
- }
|
|
|
-
|
|
|
/// @brief returns path do the data directory
|
|
|
///
|
|
|
/// This method returns a path to writable directory that DHCP servers
|
|
@@ -130,22 +92,6 @@ public:
|
|
|
/// @param datadir New data directory.
|
|
|
void setDataDir(const std::string& datadir);
|
|
|
|
|
|
- /// @brief Sets whether server should send back client-id in DHCPv4
|
|
|
- ///
|
|
|
- /// This is a compatibility flag. The default (true) is compliant with
|
|
|
- /// RFC6842. False is for backward compatibility.
|
|
|
- ///
|
|
|
- /// @param echo should the client-id be sent or not
|
|
|
- void echoClientId(const bool echo) {
|
|
|
- echo_v4_client_id_ = echo;
|
|
|
- }
|
|
|
-
|
|
|
- /// @brief Returns whether server should send back client-id in DHCPv4.
|
|
|
- /// @return true if client-id should be returned, false otherwise.
|
|
|
- bool echoClientId() const {
|
|
|
- return (echo_v4_client_id_);
|
|
|
- }
|
|
|
-
|
|
|
/// @brief Updates the DHCP-DDNS client configuration to the given value.
|
|
|
///
|
|
|
/// Passes the new configuration to the D2ClientMgr instance,
|
|
@@ -317,14 +263,6 @@ protected:
|
|
|
/// @brief virtual destructor
|
|
|
virtual ~CfgMgr();
|
|
|
|
|
|
- /// @brief a container for IPv6 subnets.
|
|
|
- ///
|
|
|
- /// That is a simple vector of pointers. It does not make much sense to
|
|
|
- /// optimize access time (e.g. using a map), because typical search
|
|
|
- /// pattern will use calling inRange() method on each subnet until
|
|
|
- /// a match is found.
|
|
|
- Subnet6Collection subnets6_;
|
|
|
-
|
|
|
private:
|
|
|
|
|
|
/// @brief Checks if current configuration is created and creates it if needed.
|
|
@@ -334,25 +272,9 @@ private:
|
|
|
/// default current configuration.
|
|
|
void ensureCurrentAllocated();
|
|
|
|
|
|
- /// @brief Checks that the IPv6 subnet with the given id already exists.
|
|
|
- ///
|
|
|
- /// @param subnet Subnet for which this function will check if the other
|
|
|
- /// subnet with equal id already exists.
|
|
|
- /// @return true if the duplicate subnet exists.
|
|
|
- bool isDuplicate(const Subnet6& subnet) const;
|
|
|
-
|
|
|
- /// @brief Container for defined DHCPv6 option spaces.
|
|
|
- OptionSpaceCollection spaces6_;
|
|
|
-
|
|
|
- /// @brief Container for defined DHCPv4 option spaces.
|
|
|
- OptionSpaceCollection spaces4_;
|
|
|
-
|
|
|
/// @brief directory where data files (e.g. server-id) are stored
|
|
|
std::string datadir_;
|
|
|
|
|
|
- /// Indicates whether v4 server should send back client-id
|
|
|
- bool echo_v4_client_id_;
|
|
|
-
|
|
|
/// @brief Manages the DHCP-DDNS client and its configuration.
|
|
|
D2ClientMgr d2_client_mgr_;
|
|
|
|