Kea  1.9.9-git
config_backend_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_DHCP4_H
8 #define CONFIG_BACKEND_DHCP4_H
9 
10 #include <cc/stamped_value.h>
12 #include <database/audit_entry.h>
13 #include <database/server.h>
16 #include <dhcp/option.h>
17 #include <dhcp/option_definition.h>
18 #include <dhcpsrv/cfg_option.h>
19 #include <dhcpsrv/shared_network.h>
20 #include <dhcpsrv/subnet.h>
21 #include <boost/shared_ptr.hpp>
22 #include <boost/date_time/posix_time/ptime.hpp>
23 #include <string>
24 
25 namespace isc {
26 namespace dhcp {
27 
86 public:
87 
89  virtual ~ConfigBackendDHCPv4() { }
90 
99  virtual Subnet4Ptr
100  getSubnet4(const db::ServerSelector& server_selector,
101  const std::string& subnet_prefix) const = 0;
102 
111  virtual Subnet4Ptr
112  getSubnet4(const db::ServerSelector& server_selector, const SubnetID& subnet_id) const = 0;
113 
121  virtual Subnet4Collection
122  getAllSubnets4(const db::ServerSelector& server_selector) const = 0;
123 
133  virtual Subnet4Collection
134  getSharedNetworkSubnets4(const db::ServerSelector& server_selector,
135  const std::string& shared_network_name) const = 0;
136 
145  virtual Subnet4Collection
146  getModifiedSubnets4(const db::ServerSelector& server_selector,
147  const boost::posix_time::ptime& modification_time) const = 0;
148 
157  virtual SharedNetwork4Ptr
158  getSharedNetwork4(const db::ServerSelector& server_selector,
159  const std::string& name) const = 0;
160 
170  getAllSharedNetworks4(const db::ServerSelector& server_selector) const = 0;
171 
182  getModifiedSharedNetworks4(const db::ServerSelector& server_selector,
183  const boost::posix_time::ptime& modification_time) const = 0;
184 
194  virtual OptionDefinitionPtr
195  getOptionDef4(const db::ServerSelector& server_selector, const uint16_t code,
196  const std::string& space) const = 0;
197 
206  virtual OptionDefContainer
207  getAllOptionDefs4(const db::ServerSelector& server_selector) const = 0;
208 
219  virtual OptionDefContainer
220  getModifiedOptionDefs4(const db::ServerSelector& server_selector,
221  const boost::posix_time::ptime& modification_time) const = 0;
222 
233  virtual OptionDescriptorPtr
234  getOption4(const db::ServerSelector& server_selector, const uint16_t code,
235  const std::string& space) const = 0;
236 
245  virtual OptionContainer
246  getAllOptions4(const db::ServerSelector& server_selector) const = 0;
247 
257  virtual OptionContainer
258  getModifiedOptions4(const db::ServerSelector& selector,
259  const boost::posix_time::ptime& modification_time) const = 0;
260 
270  virtual data::StampedValuePtr
271  getGlobalParameter4(const db::ServerSelector& selector,
272  const std::string& name) const = 0;
273 
282  getAllGlobalParameters4(const db::ServerSelector& selector) const = 0;
283 
294  const boost::posix_time::ptime& modification_time) const = 0;
295 
309  getRecentAuditEntries(const db::ServerSelector& server_selector,
310  const boost::posix_time::ptime& modification_time,
311  const uint64_t& modification_id) const = 0;
312 
319  virtual db::ServerCollection
320  getAllServers4() const = 0;
321 
327  virtual db::ServerPtr
328  getServer4(const data::ServerTag& server_tag) const = 0;
329 
337  virtual void
338  createUpdateSubnet4(const db::ServerSelector& server_selector,
339  const Subnet4Ptr& subnet) = 0;
340 
348  virtual void
349  createUpdateSharedNetwork4(const db::ServerSelector& server_selector,
350  const SharedNetwork4Ptr& shared_network) = 0;
351 
359  virtual void
360  createUpdateOptionDef4(const db::ServerSelector& server_selector,
361  const OptionDefinitionPtr& option_def) = 0;
362 
370  virtual void
371  createUpdateOption4(const db::ServerSelector& server_selector,
372  const OptionDescriptorPtr& option) = 0;
373 
383  virtual void
384  createUpdateOption4(const db::ServerSelector& selector,
385  const std::string& shared_network_name,
386  const OptionDescriptorPtr& option) = 0;
387 
396  virtual void
397  createUpdateOption4(const db::ServerSelector& server_selector,
398  const SubnetID& subnet_id,
399  const OptionDescriptorPtr& option) = 0;
400 
412  virtual void
413  createUpdateOption4(const db::ServerSelector& server_selector,
414  const asiolink::IOAddress& pool_start_address,
415  const asiolink::IOAddress& pool_end_address,
416  const OptionDescriptorPtr& option) = 0;
417 
425  virtual void
426  createUpdateGlobalParameter4(const db::ServerSelector& server_selector,
427  const data::StampedValuePtr& value) = 0;
428 
432  virtual void
433  createUpdateServer4(const db::ServerPtr& server) = 0;
434 
443  virtual uint64_t
444  deleteSubnet4(const db::ServerSelector& server_selector,
445  const std::string& subnet_prefix) = 0;
446 
455  virtual uint64_t
456  deleteSubnet4(const db::ServerSelector& server_selector, const SubnetID& subnet_id) = 0;
457 
465  virtual uint64_t
466  deleteAllSubnets4(const db::ServerSelector& server_selector) = 0;
467 
477  virtual uint64_t
478  deleteSharedNetworkSubnets4(const db::ServerSelector& server_selector,
479  const std::string& shared_network_name) = 0;
480 
489  virtual uint64_t
490  deleteSharedNetwork4(const db::ServerSelector& server_selector,
491  const std::string& name) = 0;
492 
500  virtual uint64_t
501  deleteAllSharedNetworks4(const db::ServerSelector& server_selector) = 0;
502 
512  virtual uint64_t
513  deleteOptionDef4(const db::ServerSelector& server_selector,
514  const uint16_t code,
515  const std::string& space) = 0;
516 
524  virtual uint64_t
525  deleteAllOptionDefs4(const db::ServerSelector& server_selector) = 0;
526 
536  virtual uint64_t
537  deleteOption4(const db::ServerSelector& server_selector,
538  const uint16_t code,
539  const std::string& space) = 0;
540 
551  virtual uint64_t
552  deleteOption4(const db::ServerSelector& selector,
553  const std::string& shared_network_name,
554  const uint16_t code,
555  const std::string& space) = 0;
556 
568  virtual uint64_t
569  deleteOption4(const db::ServerSelector& server_selector,
570  const SubnetID& subnet_id,
571  const uint16_t code,
572  const std::string& space) = 0;
573 
587  virtual uint64_t
588  deleteOption4(const db::ServerSelector& server_selector,
589  const asiolink::IOAddress& pool_start_address,
590  const asiolink::IOAddress& pool_end_address,
591  const uint16_t code,
592  const std::string& space) = 0;
593 
602  virtual uint64_t
603  deleteGlobalParameter4(const db::ServerSelector& server_selector,
604  const std::string& name) = 0;
605 
613  virtual uint64_t
614  deleteAllGlobalParameters4(const db::ServerSelector& server_selector) = 0;
615 
620  virtual uint64_t
621  deleteServer4(const data::ServerTag& server_tag) = 0;
622 
627  virtual uint64_t
628  deleteAllServers4() = 0;
629 };
630 
632 typedef boost::shared_ptr<ConfigBackendDHCPv4> ConfigBackendDHCPv4Ptr;
633 
634 } // end of namespace isc::dhcp
635 } // end of namespace isc
636 
637 #endif // CONFIG_BACKEND_DHCP4_H
virtual db::ServerPtr getServer4(const data::ServerTag &server_tag) const =0
Retrieves a server.
virtual SharedNetwork4Ptr getSharedNetwork4(const db::ServerSelector &server_selector, const std::string &name) const =0
Retrieves shared network by name.
Interface for Kea server specific configuration backend implementations.
virtual OptionDefContainer getModifiedOptionDefs4(const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves option definitions modified after specified time.
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
boost::shared_ptr< ConfigBackendDHCPv4 > ConfigBackendDHCPv4Ptr
Shared pointer to the ConfigBackendDHCPv4 instance.
virtual Subnet4Collection getSharedNetworkSubnets4(const db::ServerSelector &server_selector, const std::string &shared_network_name) const =0
Retrieves all subnets belonging to a specified shared network.
boost::shared_ptr< Server > ServerPtr
Shared pointer to the Server class.
Definition: server.h:19
virtual ~ConfigBackendDHCPv4()
Virtual destructor.
virtual data::StampedValuePtr getGlobalParameter4(const db::ServerSelector &selector, const std::string &name) const =0
Retrieves global parameter value.
virtual data::StampedValueCollection getModifiedGlobalParameters4(const db::ServerSelector &selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves global parameters modified after specified time.
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 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.
virtual data::StampedValueCollection getAllGlobalParameters4(const db::ServerSelector &selector) const =0
Retrieves all global parameters.
virtual SharedNetwork4Collection getAllSharedNetworks4(const db::ServerSelector &server_selector) const =0
Retrieves all shared networks.
virtual OptionContainer getModifiedOptions4(const db::ServerSelector &selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves options 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 deleteSubnet4(const db::ServerSelector &server_selector, const std::string &subnet_prefix)=0
Deletes subnet by prefix.
virtual uint64_t deleteAllServers4()=0
Deletes all servers from the backend except the logical server 'all'.
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 db::AuditEntryCollection getRecentAuditEntries(const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time, const uint64_t &modification_id) const =0
Retrieves the most recent audit entries.
virtual uint64_t deleteServer4(const data::ServerTag &server_tag)=0
Deletes a server from the backend.
Server selector for associating objects in a database with specific servers.
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.
virtual uint64_t deleteAllSubnets4(const db::ServerSelector &server_selector)=0
Deletes all subnets.
virtual void createUpdateSubnet4(const db::ServerSelector &server_selector, const Subnet4Ptr &subnet)=0
Creates or updates a subnet.
boost::shared_ptr< SharedNetwork4 > SharedNetwork4Ptr
Pointer to SharedNetwork4 object.
virtual void createUpdateOptionDef4(const db::ServerSelector &server_selector, const OptionDefinitionPtr &option_def)=0
Creates or updates an option definition.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual Subnet4Collection getAllSubnets4(const db::ServerSelector &server_selector) const =0
Retrieves all subnets.
virtual uint64_t deleteOptionDef4(const db::ServerSelector &server_selector, const uint16_t code, const std::string &space)=0
Deletes option definition.
virtual uint64_t deleteAllOptionDefs4(const db::ServerSelector &server_selector)=0
Deletes all option definitions.
virtual db::ServerCollection getAllServers4() const =0
Retrieves all servers.
virtual uint64_t deleteOption4(const db::ServerSelector &server_selector, const uint16_t code, const std::string &space)=0
Deletes global option.
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.
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 uint64_t deleteAllSharedNetworks4(const db::ServerSelector &server_selector)=0
Deletes all shared networks.
virtual OptionDefContainer getAllOptionDefs4(const db::ServerSelector &server_selector) const =0
Retrieves all option definitions.
virtual uint64_t deleteSharedNetwork4(const db::ServerSelector &server_selector, const std::string &name)=0
Deletes shared network by name.
virtual OptionContainer getAllOptions4(const db::ServerSelector &server_selector) const =0
Retrieves all global options.
virtual SharedNetwork4Collection getModifiedSharedNetworks4(const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves shared networks modified after specified time.
virtual void createUpdateOption4(const db::ServerSelector &server_selector, const OptionDescriptorPtr &option)=0
Creates or updates global option.
virtual uint64_t deleteAllGlobalParameters4(const db::ServerSelector &server_selector)=0
Deletes all global parameters.
virtual Subnet4Collection getModifiedSubnets4(const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves subnets modified after specified time.
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
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
virtual uint64_t deleteSharedNetworkSubnets4(const db::ServerSelector &server_selector, const std::string &shared_network_name)=0
Deletes all subnets belonging to a specified shared network.
virtual Subnet4Ptr getSubnet4(const db::ServerSelector &server_selector, const std::string &subnet_prefix) const =0
Retrieves a single subnet by subnet_prefix.
Interface implemented by DHCPv4 configuration backends.
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 void createUpdateServer4(const db::ServerPtr &server)=0
Creates or updates a server.
virtual void createUpdateGlobalParameter4(const db::ServerSelector &server_selector, const data::StampedValuePtr &value)=0
Creates or updates global parameter.
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
Definition: lease.h:24
virtual uint64_t deleteGlobalParameter4(const db::ServerSelector &server_selector, const std::string &name)=0
Deletes global parameter.
virtual void createUpdateSharedNetwork4(const db::ServerSelector &server_selector, const SharedNetwork4Ptr &shared_network)=0
Creates or updates a shared network.