Kea  1.5.0
config_backend_dhcp4.h
Go to the documentation of this file.
1 // Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef CONFIG_BACKEND_DHCP4_H
8 #define CONFIG_BACKEND_DHCP4_H
9 
10 #include <cc/stamped_value.h>
13 #include <dhcp/option.h>
14 #include <dhcp/option_definition.h>
15 #include <dhcpsrv/cfg_option.h>
16 #include <dhcpsrv/shared_network.h>
17 #include <dhcpsrv/subnet.h>
18 #include <boost/shared_ptr.hpp>
19 #include <boost/date_time/posix_time/ptime.hpp>
20 #include <string>
21 
22 namespace isc {
23 namespace dhcp {
24 
27 public:
28 
30  virtual ~ConfigBackendDHCPv4() { }
31 
37  virtual Subnet4Ptr
38  getSubnet4(const db::ServerSelector& server_selector,
39  const std::string& subnet_prefix) const = 0;
40 
46  virtual Subnet4Ptr
47  getSubnet4(const db::ServerSelector& server_selector, const SubnetID& subnet_id) const = 0;
48 
53  virtual Subnet4Collection
54  getAllSubnets4(const db::ServerSelector& server_selector) const = 0;
55 
61  virtual Subnet4Collection
62  getModifiedSubnets4(const db::ServerSelector& server_selector,
63  const boost::posix_time::ptime& modification_time) const = 0;
64 
70  virtual SharedNetwork4Ptr
71  getSharedNetwork4(const db::ServerSelector& server_selector,
72  const std::string& name) const = 0;
73 
80  getAllSharedNetworks4(const db::ServerSelector& server_selector) const = 0;
81 
90  const boost::posix_time::ptime& modification_time) const = 0;
91 
98  virtual OptionDefinitionPtr
99  getOptionDef4(const db::ServerSelector& server_selector, const uint16_t code,
100  const std::string& space) const = 0;
101 
107  virtual OptionDefContainer
108  getAllOptionDefs4(const db::ServerSelector& server_selector) const = 0;
109 
117  virtual OptionDefContainer
119  const boost::posix_time::ptime& modification_time) const = 0;
120 
128  virtual OptionDescriptorPtr
129  getOption4(const db::ServerSelector& server_selector, const uint16_t code,
130  const std::string& space) const = 0;
131 
137  virtual OptionContainer
138  getAllOptions4(const db::ServerSelector& server_selector) const = 0;
139 
146  virtual OptionContainer
148  const boost::posix_time::ptime& modification_time) const = 0;
149 
156  virtual data::StampedValuePtr
158  const std::string& name) const = 0;
159 
162  getAllGlobalParameters4(const db::ServerSelector& selector) const = 0;
163 
171  const boost::posix_time::ptime& modification_time) const = 0;
172 
177  virtual void
178  createUpdateSubnet4(const db::ServerSelector& server_selector,
179  const Subnet4Ptr& subnet) = 0;
180 
185  virtual void
187  const SharedNetwork4Ptr& shared_network) = 0;
188 
193  virtual void
195  const OptionDefinitionPtr& option_def) = 0;
196 
201  virtual void
202  createUpdateOption4(const db::ServerSelector& server_selector,
203  const OptionDescriptorPtr& option) = 0;
204 
211  virtual void
213  const std::string& shared_network_name,
214  const OptionDescriptorPtr& option) = 0;
215 
221  virtual void
222  createUpdateOption4(const db::ServerSelector& server_selector,
223  const SubnetID& subnet_id,
224  const OptionDescriptorPtr& option) = 0;
225 
234  virtual void
235  createUpdateOption4(const db::ServerSelector& server_selector,
236  const asiolink::IOAddress& pool_start_address,
237  const asiolink::IOAddress& pool_end_address,
238  const OptionDescriptorPtr& option) = 0;
239 
244  virtual void
246  const data::StampedValuePtr& value) = 0;
247 
253  virtual uint64_t
254  deleteSubnet4(const db::ServerSelector& server_selector,
255  const std::string& subnet_prefix) = 0;
256 
262  virtual uint64_t
263  deleteSubnet4(const db::ServerSelector& server_selector, const SubnetID& subnet_id) = 0;
264 
269  virtual uint64_t
270  deleteAllSubnets4(const db::ServerSelector& server_selector) = 0;
271 
277  virtual uint64_t
278  deleteSharedNetwork4(const db::ServerSelector& server_selector,
279  const std::string& name) = 0;
280 
285  virtual uint64_t
286  deleteAllSharedNetworks4(const db::ServerSelector& server_selector) = 0;
287 
294  virtual uint64_t
295  deleteOptionDef4(const db::ServerSelector& server_selector, const uint16_t code,
296  const std::string& space) = 0;
297 
302  virtual uint64_t
303  deleteAllOptionDefs4(const db::ServerSelector& server_selector) = 0;
304 
311  virtual uint64_t
312  deleteOption4(const db::ServerSelector& server_selector, const uint16_t code,
313  const std::string& space) = 0;
314 
322  virtual uint64_t
324  const std::string& shared_network_name,
325  const uint16_t code,
326  const std::string& space) = 0;
327 
336  virtual uint64_t
337  deleteOption4(const db::ServerSelector& server_selector, const SubnetID& subnet_id,
338  const uint16_t code, const std::string& space) = 0;
339 
350  virtual uint64_t
351  deleteOption4(const db::ServerSelector& server_selector,
352  const asiolink::IOAddress& pool_start_address,
353  const asiolink::IOAddress& pool_end_address,
354  const uint16_t code,
355  const std::string& space) = 0;
356 
362  virtual uint64_t
364  const std::string& name) = 0;
365 
370  virtual uint64_t
371  deleteAllGlobalParameters4(const db::ServerSelector& server_selector) = 0;
372 };
373 
375 typedef boost::shared_ptr<ConfigBackendDHCPv4> ConfigBackendDHCPv4Ptr;
376 
377 } // end of namespace isc::dhcp
378 } // end of namespace isc
379 
380 #endif // CONFIG_BACKEND_DHCP4_H
isc::dhcp::ConfigBackendDHCPv4
Interface implemented by DHCPv4 configuration backends.
Definition: config_backend_dhcp4.h:26
isc::dhcp::OptionDefinitionPtr
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
Definition: option_definition.h:51
isc::dhcp::ConfigBackendDHCPv4::deleteOptionDef4
virtual uint64_t deleteOptionDef4(const db::ServerSelector &server_selector, const uint16_t code, const std::string &space)=0
Deletes option definition.
stamped_value.h
isc::dhcp::ConfigBackendDHCPv4::createUpdateSharedNetwork4
virtual void createUpdateSharedNetwork4(const db::ServerSelector &server_selector, const SharedNetwork4Ptr &shared_network)=0
Creates or updates a shared network.
base_config_backend.h
isc::dhcp::SharedNetwork4Collection
boost::multi_index_container< SharedNetwork4Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SharedNetworkRandomAccessIndexTag > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SharedNetworkNameIndexTag >, boost::multi_index::const_mem_fun< SharedNetwork4, std::string, &SharedNetwork4::getName > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SharedNetworkServerIdIndexTag >, boost::multi_index::const_mem_fun< Network4, asiolink::IOAddress, &Network4::getServerId > > >> SharedNetwork4Collection
Multi index container holding shared networks.
Definition: shared_network.h:194
isc::dhcp::ConfigBackendDHCPv4::getSubnet4
virtual Subnet4Ptr getSubnet4(const db::ServerSelector &server_selector, const std::string &subnet_prefix) const =0
Retrieves a single subnet by subnet_prefix.
isc::dhcp::ConfigBackendDHCPv4::deleteOption4
virtual uint64_t deleteOption4(const db::ServerSelector &server_selector, const uint16_t code, const std::string &space)=0
Deletes global option.
isc::dhcp::ConfigBackendDHCPv4::createUpdateOption4
virtual void createUpdateOption4(const db::ServerSelector &server_selector, const SubnetID &subnet_id, const OptionDescriptorPtr &option)=0
Creates or updates subnet level option.
isc::dhcp::ConfigBackendDHCPv4::getAllSubnets4
virtual Subnet4Collection getAllSubnets4(const db::ServerSelector &server_selector) const =0
Retrieves all subnets.
isc::dhcp::ConfigBackendDHCPv4Ptr
boost::shared_ptr< ConfigBackendDHCPv4 > ConfigBackendDHCPv4Ptr
Shared pointer to the ConfigBackendDHCPv4 instance.
Definition: config_backend_dhcp4.h:375
isc::dhcp::ConfigBackendDHCPv4::getSubnet4
virtual Subnet4Ptr getSubnet4(const db::ServerSelector &server_selector, const SubnetID &subnet_id) const =0
Retrieves a single subnet by subnet identifier.
isc::dhcp::ConfigBackendDHCPv4::deleteOption4
virtual uint64_t deleteOption4(const db::ServerSelector &selector, const std::string &shared_network_name, const uint16_t code, const std::string &space)=0
Deletes shared network level option.
isc::dhcp::ConfigBackendDHCPv4::deleteOption4
virtual uint64_t deleteOption4(const db::ServerSelector &server_selector, const SubnetID &subnet_id, const uint16_t code, const std::string &space)=0
Deletes subnet level option.
isc::dhcp::ConfigBackendDHCPv4::deleteSubnet4
virtual uint64_t deleteSubnet4(const db::ServerSelector &server_selector, const SubnetID &subnet_id)=0
Deletes subnet by identifier.
isc::dhcp::ConfigBackendDHCPv4::deleteAllGlobalParameters4
virtual uint64_t deleteAllGlobalParameters4(const db::ServerSelector &server_selector)=0
Deletes all global parameters.
isc::dhcp::ConfigBackendDHCPv4::getSharedNetwork4
virtual SharedNetwork4Ptr getSharedNetwork4(const db::ServerSelector &server_selector, const std::string &name) const =0
Retrieves shared network by name.
server_selector.h
isc::dhcp::SharedNetwork4Ptr
boost::shared_ptr< SharedNetwork4 > SharedNetwork4Ptr
Pointer to SharedNetwork4 object.
Definition: shared_network.h:163
shared_network.h
isc::dhcp::ConfigBackendDHCPv4::createUpdateOptionDef4
virtual void createUpdateOptionDef4(const db::ServerSelector &server_selector, const OptionDefinitionPtr &option_def)=0
Creates or updates an option definition.
isc::dhcp::ConfigBackendDHCPv4::getModifiedOptionDefs4
virtual OptionDefContainer getModifiedOptionDefs4(const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves option definitions modified after specified time.
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::dhcp::ConfigBackendDHCPv4::createUpdateOption4
virtual void createUpdateOption4(const db::ServerSelector &server_selector, const asiolink::IOAddress &pool_start_address, const asiolink::IOAddress &pool_end_address, const OptionDescriptorPtr &option)=0
Creates or updates pool level option.
isc::dhcp::ConfigBackendDHCPv4::deleteOption4
virtual uint64_t deleteOption4(const db::ServerSelector &server_selector, const asiolink::IOAddress &pool_start_address, const asiolink::IOAddress &pool_end_address, const uint16_t code, const std::string &space)=0
Deletes pool level option.
isc::dhcp::ConfigBackendDHCPv4::getModifiedSubnets4
virtual Subnet4Collection getModifiedSubnets4(const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves subnets modified after specified time.
isc::dhcp::ConfigBackendDHCPv4::getAllOptionDefs4
virtual OptionDefContainer getAllOptionDefs4(const db::ServerSelector &server_selector) const =0
Retrieves all option definitions.
isc::db::ServerSelector
Server selector for associating objects in a database with specific servers.
Definition: server_selector.h:45
isc::dhcp::ConfigBackendDHCPv4::getModifiedSharedNetworks4
virtual SharedNetwork4Collection getModifiedSharedNetworks4(const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves shared networks modified after specified time.
isc::dhcp::OptionContainer
boost::multi_index_container< OptionDescriptor, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_non_unique< KeyFromKeyExtractor< boost::multi_index::const_mem_fun< Option, uint16_t, &Option::getType >, boost::multi_index::member< OptionDescriptor, OptionPtr, &OptionDescriptor::option_ > > >, boost::multi_index::hashed_non_unique< boost::multi_index::member< OptionDescriptor, bool, &OptionDescriptor::persistent_ > > >> OptionContainer
Multi index container for DHCP option descriptors.
Definition: cfg_option.h:203
isc::dhcp::ConfigBackendDHCPv4::getModifiedOptions4
virtual OptionContainer getModifiedOptions4(const db::ServerSelector &selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves option modified after specified time.
subnet.h
cfg_option.h
isc::dhcp::ConfigBackendDHCPv4::deleteSharedNetwork4
virtual uint64_t deleteSharedNetwork4(const db::ServerSelector &server_selector, const std::string &name)=0
Deletes shared network by name.
isc::dhcp::Subnet4Ptr
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition: subnet.h:464
option_definition.h
isc::dhcp::ConfigBackendDHCPv4::~ConfigBackendDHCPv4
virtual ~ConfigBackendDHCPv4()
Virtual destructor.
Definition: config_backend_dhcp4.h:30
isc::dhcp::OptionDefContainer
boost::multi_index_container< OptionDefinitionPtr, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_non_unique< boost::multi_index::const_mem_fun< OptionDefinition, uint16_t, &OptionDefinition::getCode > >, boost::multi_index::hashed_non_unique< boost::multi_index::const_mem_fun< OptionDefinition, std::string, &OptionDefinition::getName > > >> OptionDefContainer
Multi index container for DHCP option definitions.
Definition: option_definition.h:816
isc::dhcp::ConfigBackendDHCPv4::getAllOptions4
virtual OptionContainer getAllOptions4(const db::ServerSelector &server_selector) const =0
Retrieves all global options.
isc::dhcp::ConfigBackendDHCPv4::deleteSubnet4
virtual uint64_t deleteSubnet4(const db::ServerSelector &server_selector, const std::string &subnet_prefix)=0
Deletes subnet by prefix.
isc::dhcp::ConfigBackendDHCPv4::createUpdateOption4
virtual void createUpdateOption4(const db::ServerSelector &selector, const std::string &shared_network_name, const OptionDescriptorPtr &option)=0
Creates or updates shared network level option.
isc::dhcp::ConfigBackendDHCPv4::getAllSharedNetworks4
virtual SharedNetwork4Collection getAllSharedNetworks4(const db::ServerSelector &server_selector) const =0
Retrieves all shared networks.
isc::data::StampedValueCollection
std::vector< StampedValuePtr > StampedValueCollection
Collection of pointers to values.
Definition: stamped_value.h:24
isc::dhcp::ConfigBackendDHCPv4::getAllGlobalParameters4
virtual data::StampedValueCollection getAllGlobalParameters4(const db::ServerSelector &selector) const =0
isc::dhcp::ConfigBackendDHCPv4::deleteAllSubnets4
virtual uint64_t deleteAllSubnets4(const db::ServerSelector &server_selector)=0
Deletes all subnets.
isc::dhcp::ConfigBackendDHCPv4::deleteAllOptionDefs4
virtual uint64_t deleteAllOptionDefs4(const db::ServerSelector &server_selector)=0
Deletes all option definitions.
isc::dhcp::ConfigBackendDHCPv4::createUpdateOption4
virtual void createUpdateOption4(const db::ServerSelector &server_selector, const OptionDescriptorPtr &option)=0
Creates or updates global option.
isc::dhcp::ConfigBackendDHCPv4::createUpdateSubnet4
virtual void createUpdateSubnet4(const db::ServerSelector &server_selector, const Subnet4Ptr &subnet)=0
Creates or updates a subnet.
isc::dhcp::ConfigBackendDHCPv4::getGlobalParameter4
virtual data::StampedValuePtr getGlobalParameter4(const db::ServerSelector &selector, const std::string &name) const =0
Retrieves global parameter value.
isc::dhcp::ConfigBackendDHCPv4::deleteAllSharedNetworks4
virtual uint64_t deleteAllSharedNetworks4(const db::ServerSelector &server_selector)=0
Deletes all shared networks.
isc::data::StampedValuePtr
boost::shared_ptr< StampedValue > StampedValuePtr
Pointer to the stamped value.
Definition: stamped_value.h:18
isc::dhcp::OptionDescriptorPtr
boost::shared_ptr< OptionDescriptor > OptionDescriptorPtr
A pointer to option descriptor.
Definition: cfg_option.h:132
isc::dhcp::ConfigBackendDHCPv4::getOptionDef4
virtual OptionDefinitionPtr getOptionDef4(const db::ServerSelector &server_selector, const uint16_t code, const std::string &space) const =0
Retrieves single option definition by code and space.
isc::dhcp::SubnetID
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
Definition: lease.h:24
option.h
isc::dhcp::ConfigBackendDHCPv4::getModifiedGlobalParameters4
virtual data::StampedValueCollection getModifiedGlobalParameters4(const db::ServerSelector &selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves global parameters modified after specified time.
isc::dhcp::ConfigBackendDHCPv4::getOption4
virtual OptionDescriptorPtr getOption4(const db::ServerSelector &server_selector, const uint16_t code, const std::string &space) const =0
Retrieves single option by code and space.
isc::dhcp::ConfigBackendDHCPv4::createUpdateGlobalParameter4
virtual void createUpdateGlobalParameter4(const db::ServerSelector &server_selector, const data::StampedValuePtr &value)=0
Creates or updates global parameter.
isc::dhcp::ConfigBackendDHCPv4::deleteGlobalParameter4
virtual uint64_t deleteGlobalParameter4(const db::ServerSelector &server_selector, const std::string &name)=0
Deletes global parameter.
isc::cb::BaseConfigBackend
Interface for Kea server specific configuration backend implementations.
Definition: base_config_backend.h:32
isc::dhcp::Subnet4Collection
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SubnetRandomAccessIndexTag > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetServerIdIndexTag >, boost::multi_index::const_mem_fun< Network4, asiolink::IOAddress, &Network4::getServerId > > >> Subnet4Collection
A collection of Subnet4 objects.
Definition: subnet.h:798