Kea  1.9.9-git
config_backend_pool_dhcp4.h
Go to the documentation of this file.
1 // Copyright (C) 2018-2020 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_POOL_DHCP4_H
8 #define CONFIG_BACKEND_POOL_DHCP4_H
9 
10 #include <cc/stamped_value.h>
13 #include <database/server.h>
16 #include <dhcp/option.h>
17 #include <dhcp/option_definition.h>
18 #include <dhcpsrv/cfg_option.h>
20 #include <dhcpsrv/shared_network.h>
21 #include <dhcpsrv/subnet.h>
22 #include <boost/date_time/posix_time/ptime.hpp>
23 #include <string>
24 
25 namespace isc {
26 namespace dhcp {
27 
32 class ConfigBackendPoolDHCPv4 : public cb::BaseConfigBackendPool<ConfigBackendDHCPv4> {
33 public:
34 
41  virtual Subnet4Ptr
42  getSubnet4(const db::BackendSelector& backend_selector,
43  const db::ServerSelector& server_selector,
44  const std::string& subnet_prefix) const;
45 
52  virtual Subnet4Ptr
53  getSubnet4(const db::BackendSelector& backend_selector,
54  const db::ServerSelector& server_selector,
55  const SubnetID& subnet_id) const;
56 
62  virtual Subnet4Collection
63  getAllSubnets4(const db::BackendSelector& backend_selector,
64  const db::ServerSelector& server_selector) const;
65 
72  virtual Subnet4Collection
73  getModifiedSubnets4(const db::BackendSelector& backend_selector,
74  const db::ServerSelector& server_selector,
75  const boost::posix_time::ptime& modification_time) const;
76 
84  virtual Subnet4Collection
85  getSharedNetworkSubnets4(const db::BackendSelector& backend_selector,
86  const db::ServerSelector& server_selector,
87  const std::string& shared_network_name) const;
88 
95  virtual SharedNetwork4Ptr
96  getSharedNetwork4(const db::BackendSelector& backend_selector,
97  const db::ServerSelector& server_selector,
98  const std::string& name) const;
99 
107  getAllSharedNetworks4(const db::BackendSelector& backend_selector,
108  const db::ServerSelector& server_selector) const;
109 
118  getModifiedSharedNetworks4(const db::BackendSelector& backend_selector,
119  const db::ServerSelector& server_selector,
120  const boost::posix_time::ptime& modification_time) const;
121 
129  virtual OptionDefinitionPtr
130  getOptionDef4(const db::BackendSelector& backend_selector,
131  const db::ServerSelector& server_selector,
132  const uint16_t code,
133  const std::string& space) const;
134 
141  virtual OptionDefContainer
142  getAllOptionDefs4(const db::BackendSelector& backend_selector,
143  const db::ServerSelector& server_selector) const;
144 
153  virtual OptionDefContainer
154  getModifiedOptionDefs4(const db::BackendSelector& backend_selector,
155  const db::ServerSelector& server_selector,
156  const boost::posix_time::ptime& modification_time) const;
157 
166  virtual OptionDescriptorPtr
167  getOption4(const db::BackendSelector& backend_selector,
168  const db::ServerSelector& server_selector,
169  const uint16_t code,
170  const std::string& space) const;
171 
178  virtual OptionContainer
179  getAllOptions4(const db::BackendSelector& backend_selector,
180  const db::ServerSelector& server_selector) const;
181 
189  virtual OptionContainer
190  getModifiedOptions4(const db::BackendSelector& backend_selector,
191  const db::ServerSelector& server_selector,
192  const boost::posix_time::ptime& modification_time) const;
193 
200  virtual data::StampedValuePtr
201  getGlobalParameter4(const db::BackendSelector& backend_selector,
202  const db::ServerSelector& server_selector,
203  const std::string& name) const;
204 
210  getAllGlobalParameters4(const db::BackendSelector& backend_selector,
211  const db::ServerSelector& server_selector) const;
212 
220  getModifiedGlobalParameters4(const db::BackendSelector& backend_selector,
221  const db::ServerSelector& server_selector,
222  const boost::posix_time::ptime& modification_time) const;
223 
235  getRecentAuditEntries(const db::BackendSelector& backend_selector,
236  const db::ServerSelector& server_selector,
237  const boost::posix_time::ptime& modification_time,
238  const uint64_t& modification_id) const;
239 
247  virtual db::ServerCollection
248  getAllServers4(const db::BackendSelector& backend_selector) const;
249 
256  virtual db::ServerPtr
257  getServer4(const db::BackendSelector& backend_selector,
258  const data::ServerTag& server_tag) const;
259 
265  virtual void
266  createUpdateSubnet4(const db::BackendSelector& backend_selector,
267  const db::ServerSelector& server_selector,
268  const Subnet4Ptr& subnet);
269 
275  virtual void
276  createUpdateSharedNetwork4(const db::BackendSelector& backend_selector,
277  const db::ServerSelector& server_selector,
278  const SharedNetwork4Ptr& shared_network);
279 
285  virtual void
286  createUpdateOptionDef4(const db::BackendSelector& backend_selector,
287  const db::ServerSelector& server_selector,
288  const OptionDefinitionPtr& option_def);
289 
295  virtual void
296  createUpdateOption4(const db::BackendSelector& backend_selector,
297  const db::ServerSelector& server_selector,
298  const OptionDescriptorPtr& option);
299 
307  virtual void
308  createUpdateOption4(const db::BackendSelector& backend_selector,
309  const db::ServerSelector& server_selector,
310  const std::string& shared_network_name,
311  const OptionDescriptorPtr& option);
312 
319  virtual void
320  createUpdateOption4(const db::BackendSelector& backend_selector,
321  const db::ServerSelector& server_selector,
322  const SubnetID& subnet_id,
323  const OptionDescriptorPtr& option);
324 
334  virtual void
335  createUpdateOption4(const db::BackendSelector& backend_selector,
336  const db::ServerSelector& server_selector,
337  const asiolink::IOAddress& pool_start_address,
338  const asiolink::IOAddress& pool_end_address,
339  const OptionDescriptorPtr& option);
340 
346  virtual void
347  createUpdateGlobalParameter4(const db::BackendSelector& backend_selector,
348  const db::ServerSelector& server_selector,
349  const data::StampedValuePtr& value);
350 
355  virtual void
356  createUpdateServer4(const db::BackendSelector& backend_selector,
357  const db::ServerPtr& server);
358 
365  virtual uint64_t
366  deleteSubnet4(const db::BackendSelector& backend_selector,
367  const db::ServerSelector& server_selector,
368  const std::string& subnet_prefix);
369 
376  virtual uint64_t
377  deleteSubnet4(const db::BackendSelector& backend_selector,
378  const db::ServerSelector& server_selector,
379  const SubnetID& subnet_id);
380 
386  virtual uint64_t
387  deleteAllSubnets4(const db::BackendSelector& backend_selector,
388  const db::ServerSelector& server_selector);
389 
397  virtual uint64_t
398  deleteSharedNetworkSubnets4(const db::BackendSelector& backend_selector,
399  const db::ServerSelector& server_selector,
400  const std::string& shared_network_name);
401 
408  virtual uint64_t
409  deleteSharedNetwork4(const db::BackendSelector& backend_selector,
410  const db::ServerSelector& server_selector,
411  const std::string& name);
412 
418  virtual uint64_t
419  deleteAllSharedNetworks4(const db::BackendSelector& backend_selector,
420  const db::ServerSelector& server_selector);
421 
429  virtual uint64_t
430  deleteOptionDef4(const db::BackendSelector& backend_selector,
431  const db::ServerSelector& server_selector,
432  const uint16_t code,
433  const std::string& space);
434 
440  virtual uint64_t
441  deleteAllOptionDefs4(const db::BackendSelector& backend_selector,
442  const db::ServerSelector& server_selector);
443 
451  virtual uint64_t
452  deleteOption4(const db::BackendSelector& backend_selector,
453  const db::ServerSelector& server_selector,
454  const uint16_t code,
455  const std::string& space);
456 
465  virtual uint64_t
466  deleteOption4(const db::BackendSelector& backend_selector,
467  const db::ServerSelector& server_selector,
468  const std::string& shared_network_name,
469  const uint16_t code,
470  const std::string& space);
471 
481  virtual uint64_t
482  deleteOption4(const db::BackendSelector& backend_selector,
483  const db::ServerSelector& server_selector,
484  const SubnetID& subnet_id,
485  const uint16_t code, const std::string& space);
486 
498  virtual uint64_t
499  deleteOption4(const db::BackendSelector& backend_selector,
500  const db::ServerSelector& server_selector,
501  const asiolink::IOAddress& pool_start_address,
502  const asiolink::IOAddress& pool_end_address,
503  const uint16_t code,
504  const std::string& space);
505 
512  virtual uint64_t
513  deleteGlobalParameter4(const db::BackendSelector& backend_selector,
514  const db::ServerSelector& server_selector,
515  const std::string& name);
516 
522  virtual uint64_t
523  deleteAllGlobalParameters4(const db::BackendSelector& backend_selector,
524  const db::ServerSelector& server_selector);
525 
531  virtual uint64_t
532  deleteServer4(const db::BackendSelector& backend_selector,
533  const data::ServerTag& server_tag);
534 
540  virtual uint64_t
541  deleteAllServers4(const db::BackendSelector& backend_selector);
542 };
543 
544 
545 } // end of namespace isc::dhcp
546 } // end of namespace isc
547 
548 #endif // CONFIG_BACKEND_POOL_DHCP4_H
virtual uint64_t deleteAllSharedNetworks4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector)
Deletes all shared networks.
virtual OptionDescriptorPtr getOption4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const uint16_t code, const std::string &space) const
Retrieves single option by code and space.
virtual data::StampedValuePtr getGlobalParameter4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const std::string &name) const
Retrieves global parameter value.
boost::shared_ptr< OptionDescriptor > OptionDescriptorPtr
A pointer to option descriptor.
Definition: cfg_option.h:31
boost::shared_ptr< StampedValue > StampedValuePtr
Pointer to the stamped value.
Definition: stamped_value.h:23
virtual Subnet4Collection getAllSubnets4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector) const
Retrieves all subnets.
boost::shared_ptr< Server > ServerPtr
Shared pointer to the Server class.
Definition: server.h:19
virtual SharedNetwork4Collection getAllSharedNetworks4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector) const
Retrieves all shared networks.
virtual uint64_t deleteAllServers4(const db::BackendSelector &backend_selector)
Deletes all servers from the backend except the logical server 'all'.
virtual uint64_t deleteAllGlobalParameters4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector)
Deletes all global parameters.
virtual Subnet4Ptr getSubnet4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const std::string &subnet_prefix) const
Retrieves a single subnet by subnet_prefix.
boost::multi_index_container< ServerPtr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< ServerTagIndexTag >, boost::multi_index::const_mem_fun< Server, std::string,&Server::getServerTagAsText > > >> ServerCollection
Multi index container for Server.
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition: subnet.h:522
virtual uint64_t deleteSharedNetwork4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const std::string &name)
Deletes shared network by name.
virtual db::AuditEntryCollection getRecentAuditEntries(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time, const uint64_t &modification_id) const
Retrieves the most recent audit entries.
virtual db::ServerCollection getAllServers4(const db::BackendSelector &backend_selector) const
Retrieves all servers from the particular backend.
virtual uint64_t deleteOptionDef4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const uint16_t code, const std::string &space)
Deletes option definition.
virtual uint64_t deleteAllOptionDefs4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector)
Deletes all option definitions.
virtual Subnet4Collection getModifiedSubnets4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const
Retrieves subnets modified after specified time.
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 > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime,&data::StampedElement::getModificationTime > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< OptionIdIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, uint64_t,&data::BaseStampedElement::getId > > >> OptionDefContainer
Multi index container for DHCP option definitions.
virtual uint64_t deleteSharedNetworkSubnets4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const std::string &shared_network_name)
Deletes all subnets belonging to a specified shared network.
virtual SharedNetwork4Collection getModifiedSharedNetworks4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const
Retrieves shared networks modified after specified time.
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< 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 > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime,&data::BaseStampedElement::getModificationTime > > >> Subnet4Collection
A collection of Subnet4 objects.
Definition: subnet.h:867
Represents a server tag.
Definition: server_tag.h:25
virtual Subnet4Collection getSharedNetworkSubnets4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const std::string &shared_network_name) const
Retrieves all subnets belonging to a specified shared network.
virtual data::StampedValueCollection getModifiedGlobalParameters4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const
Retrieves global parameters modified after specified time.
virtual OptionDefContainer getModifiedOptionDefs4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const
Retrieves option definitions modified after specified time.
virtual uint64_t deleteServer4(const db::BackendSelector &backend_selector, const data::ServerTag &server_tag)
Deletes a server from the backend.
virtual uint64_t deleteGlobalParameter4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const std::string &name)
Deletes global parameter.
Server selector for associating objects in a database with specific servers.
virtual void createUpdateSubnet4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const Subnet4Ptr &subnet)
Creates or updates a subnet.
Base class for configuration backend pools.
boost::shared_ptr< SharedNetwork4 > SharedNetwork4Ptr
Pointer to SharedNetwork4 object.
virtual db::ServerPtr getServer4(const db::BackendSelector &backend_selector, const data::ServerTag &server_tag) const
Retrieves a server from the particular backend.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual OptionContainer getAllOptions4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector) const
Retrieves all global options.
virtual void createUpdateSharedNetwork4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const SharedNetwork4Ptr &shared_network)
Creates or updates a shared network.
boost::multi_index_container< StampedValuePtr, boost::multi_index::indexed_by< boost::multi_index::hashed_non_unique< boost::multi_index::tag< StampedValueNameIndexTag >, boost::multi_index::const_mem_fun< StampedValue, std::string,&StampedValue::getName > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< StampedValueModificationTimeIndexTag >, boost::multi_index::const_mem_fun< BaseStampedElement, boost::posix_time::ptime,&BaseStampedElement::getModificationTime > > >> StampedValueCollection
Multi index container for StampedValue.
virtual OptionDefContainer getAllOptionDefs4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector) const
Retrieves all option definitions.
boost::multi_index_container< SharedNetwork4Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SharedNetworkRandomAccessIndexTag > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< SharedNetworkIdIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, uint64_t,&data::BaseStampedElement::getId > >, 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 > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SharedNetworkModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime,&data::BaseStampedElement::getModificationTime > > >> SharedNetwork4Collection
Multi index container holding shared networks.
virtual void createUpdateOption4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const OptionDescriptorPtr &option)
Creates or updates global option.
Config Backend selector.
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_ > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime,&data::BaseStampedElement::getModificationTime > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< OptionIdIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, uint64_t,&data::BaseStampedElement::getId > > >> OptionContainer
Multi index container for DHCP option descriptors.
Definition: cfg_option.h:269
virtual SharedNetwork4Ptr getSharedNetwork4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const std::string &name) const
Retrieves shared network by name.
Implementation of the Configuration Backend Pool for DHCPv4.
virtual void createUpdateServer4(const db::BackendSelector &backend_selector, const db::ServerPtr &server)
Creates or updates a server.
virtual void createUpdateGlobalParameter4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const data::StampedValuePtr &value)
Creates or updates global string parameter.
virtual uint64_t deleteAllSubnets4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector)
Deletes all subnets.
virtual uint64_t deleteOption4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const uint16_t code, const std::string &space)
Deletes global option.
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
virtual data::StampedValueCollection getAllGlobalParameters4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector) const
Retrieves all global parameters.
virtual OptionDefinitionPtr getOptionDef4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const uint16_t code, const std::string &space) const
Retrieves single option definition by code and space.
virtual OptionContainer getModifiedOptions4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const
Retrieves option modified after specified time.
virtual void createUpdateOptionDef4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const OptionDefinitionPtr &option_def)
Creates or updates an option definition.
boost::multi_index_container< AuditEntryPtr, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::tag< AuditEntryObjectTypeTag >, boost::multi_index::composite_key< AuditEntry, boost::multi_index::const_mem_fun< AuditEntry, std::string,&AuditEntry::getObjectType >, boost::multi_index::const_mem_fun< AuditEntry, AuditEntry::ModificationType,&AuditEntry::getModificationType > > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< AuditEntryModificationTimeIdTag >, boost::multi_index::composite_key< AuditEntry, boost::multi_index::const_mem_fun< AuditEntry, boost::posix_time::ptime,&AuditEntry::getModificationTime >, boost::multi_index::const_mem_fun< AuditEntry, uint64_t,&AuditEntry::getRevisionId > > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< AuditEntryObjectIdTag >, boost::multi_index::const_mem_fun< AuditEntry, uint64_t,&AuditEntry::getObjectId > > >> AuditEntryCollection
Multi index container holding AuditEntry instances.
Definition: audit_entry.h:291
virtual uint64_t deleteSubnet4(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const std::string &subnet_prefix)
Deletes subnet by prefix.
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
Definition: lease.h:24