Kea  2.1.7-git
config_backend_dhcp4.h
Go to the documentation of this file.
1 // Copyright (C) 2018-2021 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>
20 #include <dhcpsrv/shared_network.h>
21 #include <dhcpsrv/subnet.h>
22 #include <boost/shared_ptr.hpp>
23 #include <boost/date_time/posix_time/ptime.hpp>
24 #include <string>
25 
26 namespace isc {
27 namespace dhcp {
28 
87 public:
88 
90  virtual ~ConfigBackendDHCPv4() { }
91 
100  virtual Subnet4Ptr
101  getSubnet4(const db::ServerSelector& server_selector,
102  const std::string& subnet_prefix) const = 0;
103 
112  virtual Subnet4Ptr
113  getSubnet4(const db::ServerSelector& server_selector, const SubnetID& subnet_id) const = 0;
114 
122  virtual Subnet4Collection
123  getAllSubnets4(const db::ServerSelector& server_selector) const = 0;
124 
134  virtual Subnet4Collection
135  getSharedNetworkSubnets4(const db::ServerSelector& server_selector,
136  const std::string& shared_network_name) const = 0;
137 
146  virtual Subnet4Collection
147  getModifiedSubnets4(const db::ServerSelector& server_selector,
148  const boost::posix_time::ptime& modification_time) const = 0;
149 
158  virtual SharedNetwork4Ptr
159  getSharedNetwork4(const db::ServerSelector& server_selector,
160  const std::string& name) const = 0;
161 
171  getAllSharedNetworks4(const db::ServerSelector& server_selector) const = 0;
172 
183  getModifiedSharedNetworks4(const db::ServerSelector& server_selector,
184  const boost::posix_time::ptime& modification_time) const = 0;
185 
195  virtual OptionDefinitionPtr
196  getOptionDef4(const db::ServerSelector& server_selector, const uint16_t code,
197  const std::string& space) const = 0;
198 
207  virtual OptionDefContainer
208  getAllOptionDefs4(const db::ServerSelector& server_selector) const = 0;
209 
220  virtual OptionDefContainer
221  getModifiedOptionDefs4(const db::ServerSelector& server_selector,
222  const boost::posix_time::ptime& modification_time) const = 0;
223 
234  virtual OptionDescriptorPtr
235  getOption4(const db::ServerSelector& server_selector, const uint16_t code,
236  const std::string& space) const = 0;
237 
246  virtual OptionContainer
247  getAllOptions4(const db::ServerSelector& server_selector) const = 0;
248 
258  virtual OptionContainer
259  getModifiedOptions4(const db::ServerSelector& selector,
260  const boost::posix_time::ptime& modification_time) const = 0;
261 
271  virtual data::StampedValuePtr
272  getGlobalParameter4(const db::ServerSelector& selector,
273  const std::string& name) const = 0;
274 
283  getAllGlobalParameters4(const db::ServerSelector& selector) const = 0;
284 
295  const boost::posix_time::ptime& modification_time) const = 0;
296 
302  virtual ClientClassDefPtr
303  getClientClass4(const db::ServerSelector& selector, const std::string& name) const = 0;
304 
309  virtual ClientClassDictionary
310  getAllClientClasses4(const db::ServerSelector& selector) const = 0;
311 
317  virtual ClientClassDictionary
319  const boost::posix_time::ptime& modification_time) const = 0;
320 
334  getRecentAuditEntries(const db::ServerSelector& server_selector,
335  const boost::posix_time::ptime& modification_time,
336  const uint64_t& modification_id) const = 0;
337 
344  virtual db::ServerCollection
345  getAllServers4() const = 0;
346 
352  virtual db::ServerPtr
353  getServer4(const data::ServerTag& server_tag) const = 0;
354 
362  virtual void
363  createUpdateSubnet4(const db::ServerSelector& server_selector,
364  const Subnet4Ptr& subnet) = 0;
365 
373  virtual void
374  createUpdateSharedNetwork4(const db::ServerSelector& server_selector,
375  const SharedNetwork4Ptr& shared_network) = 0;
376 
384  virtual void
385  createUpdateOptionDef4(const db::ServerSelector& server_selector,
386  const OptionDefinitionPtr& option_def) = 0;
387 
395  virtual void
396  createUpdateOption4(const db::ServerSelector& server_selector,
397  const OptionDescriptorPtr& option) = 0;
398 
408  virtual void
409  createUpdateOption4(const db::ServerSelector& selector,
410  const std::string& shared_network_name,
411  const OptionDescriptorPtr& option) = 0;
412 
421  virtual void
422  createUpdateOption4(const db::ServerSelector& server_selector,
423  const SubnetID& subnet_id,
424  const OptionDescriptorPtr& option) = 0;
425 
437  virtual void
438  createUpdateOption4(const db::ServerSelector& server_selector,
439  const asiolink::IOAddress& pool_start_address,
440  const asiolink::IOAddress& pool_end_address,
441  const OptionDescriptorPtr& option) = 0;
442 
450  virtual void
451  createUpdateGlobalParameter4(const db::ServerSelector& server_selector,
452  const data::StampedValuePtr& value) = 0;
453 
462  virtual void
463  createUpdateClientClass4(const db::ServerSelector& server_selector,
464  const ClientClassDefPtr& client_class,
465  const std::string& follow_class_name) = 0;
466 
470  virtual void
471  createUpdateServer4(const db::ServerPtr& server) = 0;
472 
481  virtual uint64_t
482  deleteSubnet4(const db::ServerSelector& server_selector,
483  const std::string& subnet_prefix) = 0;
484 
493  virtual uint64_t
494  deleteSubnet4(const db::ServerSelector& server_selector, const SubnetID& subnet_id) = 0;
495 
503  virtual uint64_t
504  deleteAllSubnets4(const db::ServerSelector& server_selector) = 0;
505 
515  virtual uint64_t
516  deleteSharedNetworkSubnets4(const db::ServerSelector& server_selector,
517  const std::string& shared_network_name) = 0;
518 
527  virtual uint64_t
528  deleteSharedNetwork4(const db::ServerSelector& server_selector,
529  const std::string& name) = 0;
530 
538  virtual uint64_t
539  deleteAllSharedNetworks4(const db::ServerSelector& server_selector) = 0;
540 
550  virtual uint64_t
551  deleteOptionDef4(const db::ServerSelector& server_selector,
552  const uint16_t code,
553  const std::string& space) = 0;
554 
562  virtual uint64_t
563  deleteAllOptionDefs4(const db::ServerSelector& server_selector) = 0;
564 
574  virtual uint64_t
575  deleteOption4(const db::ServerSelector& server_selector,
576  const uint16_t code,
577  const std::string& space) = 0;
578 
589  virtual uint64_t
590  deleteOption4(const db::ServerSelector& selector,
591  const std::string& shared_network_name,
592  const uint16_t code,
593  const std::string& space) = 0;
594 
606  virtual uint64_t
607  deleteOption4(const db::ServerSelector& server_selector,
608  const SubnetID& subnet_id,
609  const uint16_t code,
610  const std::string& space) = 0;
611 
625  virtual uint64_t
626  deleteOption4(const db::ServerSelector& server_selector,
627  const asiolink::IOAddress& pool_start_address,
628  const asiolink::IOAddress& pool_end_address,
629  const uint16_t code,
630  const std::string& space) = 0;
631 
640  virtual uint64_t
641  deleteGlobalParameter4(const db::ServerSelector& server_selector,
642  const std::string& name) = 0;
643 
651  virtual uint64_t
652  deleteAllGlobalParameters4(const db::ServerSelector& server_selector) = 0;
653 
659  virtual uint64_t
660  deleteClientClass4(const db::ServerSelector& server_selector,
661  const std::string& name) = 0;
662 
667  virtual uint64_t
668  deleteAllClientClasses4(const db::ServerSelector& server_selector) = 0;
669 
674  virtual uint64_t
675  deleteServer4(const data::ServerTag& server_tag) = 0;
676 
681  virtual uint64_t
682  deleteAllServers4() = 0;
683 };
684 
686 typedef boost::shared_ptr<ConfigBackendDHCPv4> ConfigBackendDHCPv4Ptr;
687 
688 } // end of namespace isc::dhcp
689 } // end of namespace isc
690 
691 #endif // CONFIG_BACKEND_DHCP4_H
virtual ClientClassDictionary getAllClientClasses4(const db::ServerSelector &selector) const =0
Retrieves all client classes.
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 ClientClassDefPtr getClientClass4(const db::ServerSelector &selector, const std::string &name) const =0
Retrieves a client class by name.
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:524
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 ClientClassDictionary getModifiedClientClasses4(const db::ServerSelector &selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves client classes modified after specified time.
virtual OptionContainer getModifiedOptions4(const db::ServerSelector &selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves options modified after specified time.
Maintains a list of ClientClassDef&#39;s.
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 &#39;all&#39;.
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:893
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 deleteAllClientClasses4(const db::ServerSelector &server_selector)=0
Deletes all client classes.
virtual uint64_t deleteAllSubnets4(const db::ServerSelector &server_selector)=0
Deletes all subnets.
boost::shared_ptr< ClientClassDef > ClientClassDefPtr
a pointer to an ClientClassDef
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-lfc.
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
virtual void createUpdateClientClass4(const db::ServerSelector &server_selector, const ClientClassDefPtr &client_class, const std::string &follow_class_name)=0
Creates or updates DHCPv4 client class.
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.
Defines classes for storing client class definitions.
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 uint64_t deleteClientClass4(const db::ServerSelector &server_selector, const std::string &name)=0
Deletes DHCPv4 client class.
virtual void createUpdateGlobalParameter4(const db::ServerSelector &server_selector, const data::StampedValuePtr &value)=0
Creates or updates global parameter.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition: subnet_id.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.