Kea 3.1.1
config_backend_dhcp4.h
Go to the documentation of this file.
1// Copyright (C) 2018-2025 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 <database/server.h>
16#include <dhcp/option.h>
18#include <dhcpsrv/cfg_option.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
26namespace isc {
27namespace dhcp {
28
87public:
88
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
136 const std::string& shared_network_name) const = 0;
137
146 virtual Subnet4Collection
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
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
222 const boost::posix_time::ptime& modification_time) const = 0;
223
236 virtual OptionDescriptorPtr
237 getOption4(const db::ServerSelector& server_selector, const uint16_t code,
238 const std::string& space,
239 const ClientClassesPtr client_classes = ClientClassesPtr()) const = 0;
240
249 virtual OptionContainer
250 getAllOptions4(const db::ServerSelector& server_selector) const = 0;
251
261 virtual OptionContainer
263 const boost::posix_time::ptime& modification_time) const = 0;
264
276 const std::string& name) const = 0;
277
286 getAllGlobalParameters4(const db::ServerSelector& selector) const = 0;
287
298 const boost::posix_time::ptime& modification_time) const = 0;
299
305 virtual ClientClassDefPtr
306 getClientClass4(const db::ServerSelector& selector, const std::string& name) const = 0;
307
313 getAllClientClasses4(const db::ServerSelector& selector) const = 0;
314
322 const boost::posix_time::ptime& modification_time) const = 0;
323
338 const boost::posix_time::ptime& modification_time,
339 const uint64_t& modification_id) const = 0;
340
348 getAllServers4() const = 0;
349
355 virtual db::ServerPtr
356 getServer4(const data::ServerTag& server_tag) const = 0;
357
365 virtual void
367 const Subnet4Ptr& subnet) = 0;
368
376 virtual void
378 const SharedNetwork4Ptr& shared_network) = 0;
379
387 virtual void
389 const OptionDefinitionPtr& option_def) = 0;
390
398 virtual void
400 const OptionDescriptorPtr& option) = 0;
401
411 virtual void
413 const std::string& shared_network_name,
414 const OptionDescriptorPtr& option) = 0;
415
424 virtual void
426 const SubnetID& subnet_id,
427 const OptionDescriptorPtr& option) = 0;
428
440 virtual void
442 const asiolink::IOAddress& pool_start_address,
443 const asiolink::IOAddress& pool_end_address,
444 const OptionDescriptorPtr& option) = 0;
445
453 virtual void
455 const data::StampedValuePtr& value) = 0;
456
465 virtual void
467 const ClientClassDefPtr& client_class,
468 const std::string& follow_class_name) = 0;
469
473 virtual void
475
484 virtual uint64_t
485 deleteSubnet4(const db::ServerSelector& server_selector,
486 const std::string& subnet_prefix) = 0;
487
496 virtual uint64_t
497 deleteSubnet4(const db::ServerSelector& server_selector, const SubnetID& subnet_id) = 0;
498
506 virtual uint64_t
507 deleteAllSubnets4(const db::ServerSelector& server_selector) = 0;
508
518 virtual uint64_t
520 const std::string& shared_network_name) = 0;
521
530 virtual uint64_t
532 const std::string& name) = 0;
533
541 virtual uint64_t
542 deleteAllSharedNetworks4(const db::ServerSelector& server_selector) = 0;
543
553 virtual uint64_t
554 deleteOptionDef4(const db::ServerSelector& server_selector,
555 const uint16_t code,
556 const std::string& space) = 0;
557
565 virtual uint64_t
566 deleteAllOptionDefs4(const db::ServerSelector& server_selector) = 0;
567
579 virtual uint64_t
580 deleteOption4(const db::ServerSelector& server_selector,
581 const uint16_t code,
582 const std::string& space,
583 ClientClassesPtr client_classes = ClientClassesPtr()) = 0;
584
597 virtual uint64_t
599 const std::string& shared_network_name,
600 const uint16_t code,
601 const std::string& space,
602 ClientClassesPtr client_classes = ClientClassesPtr()) = 0;
603
617 virtual uint64_t
618 deleteOption4(const db::ServerSelector& server_selector,
619 const SubnetID& subnet_id,
620 const uint16_t code,
621 const std::string& space,
622 ClientClassesPtr client_classes = ClientClassesPtr()) = 0;
623
639 virtual uint64_t
640 deleteOption4(const db::ServerSelector& server_selector,
641 const asiolink::IOAddress& pool_start_address,
642 const asiolink::IOAddress& pool_end_address,
643 const uint16_t code,
644 const std::string& space,
645 ClientClassesPtr client_classes = ClientClassesPtr()) = 0;
646
655 virtual uint64_t
657 const std::string& name) = 0;
658
666 virtual uint64_t
668
674 virtual uint64_t
676 const std::string& name) = 0;
677
682 virtual uint64_t
683 deleteAllClientClasses4(const db::ServerSelector& server_selector) = 0;
684
689 virtual uint64_t
690 deleteServer4(const data::ServerTag& server_tag) = 0;
691
696 virtual uint64_t
698};
699
701typedef boost::shared_ptr<ConfigBackendDHCPv4> ConfigBackendDHCPv4Ptr;
702
703} // end of namespace isc::dhcp
704} // end of namespace isc
705
706#endif // CONFIG_BACKEND_DHCP4_H
Interface for Kea server specific configuration backend implementations.
Represents a server tag.
Definition server_tag.h:25
Server selector for associating objects in a database with specific servers.
Maintains a list of ClientClassDef's.
Interface implemented by DHCPv4 configuration backends.
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.
virtual uint64_t deleteSubnet4(const db::ServerSelector &server_selector, const SubnetID &subnet_id)=0
Deletes subnet by identifier.
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 data::StampedValueCollection getModifiedGlobalParameters4(const db::ServerSelector &selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves global parameters modified after specified time.
virtual OptionDescriptorPtr getOption4(const db::ServerSelector &server_selector, const uint16_t code, const std::string &space, const ClientClassesPtr client_classes=ClientClassesPtr()) 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 deleteAllGlobalParameters4(const db::ServerSelector &server_selector)=0
Deletes all global parameters.
virtual uint64_t deleteGlobalParameter4(const db::ServerSelector &server_selector, const std::string &name)=0
Deletes global parameter.
virtual OptionDefContainer getAllOptionDefs4(const db::ServerSelector &server_selector) const =0
Retrieves all option definitions.
virtual void createUpdateOptionDef4(const db::ServerSelector &server_selector, const OptionDefinitionPtr &option_def)=0
Creates or updates an option definition.
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 Subnet4Collection getAllSubnets4(const db::ServerSelector &server_selector) const =0
Retrieves all subnets.
virtual OptionContainer getModifiedOptions4(const db::ServerSelector &selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves options modified after specified time.
virtual ClientClassDictionary getAllClientClasses4(const db::ServerSelector &selector) const =0
Retrieves all client classes.
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 uint64_t deleteOption4(const db::ServerSelector &server_selector, const SubnetID &subnet_id, const uint16_t code, const std::string &space, ClientClassesPtr client_classes=ClientClassesPtr())=0
Deletes subnet level option.
virtual SharedNetwork4Ptr getSharedNetwork4(const db::ServerSelector &server_selector, const std::string &name) const =0
Retrieves shared network by name.
virtual uint64_t deleteOption4(const db::ServerSelector &server_selector, const uint16_t code, const std::string &space, ClientClassesPtr client_classes=ClientClassesPtr())=0
Deletes global option.
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 uint64_t deleteAllOptionDefs4(const db::ServerSelector &server_selector)=0
Deletes all option definitions.
virtual ClientClassDictionary getModifiedClientClasses4(const db::ServerSelector &selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves client classes modified after specified time.
virtual uint64_t deleteAllSharedNetworks4(const db::ServerSelector &server_selector)=0
Deletes all shared networks.
virtual void createUpdateSubnet4(const db::ServerSelector &server_selector, const Subnet4Ptr &subnet)=0
Creates or updates a subnet.
virtual void createUpdateOption4(const db::ServerSelector &selector, const std::string &shared_network_name, const OptionDescriptorPtr &option)=0
Creates or updates shared network level option.
virtual uint64_t deleteAllServers4()=0
Deletes all servers from the backend except the logical server 'all'.
virtual void createUpdateGlobalParameter4(const db::ServerSelector &server_selector, const data::StampedValuePtr &value)=0
Creates or updates global parameter.
virtual void createUpdateSharedNetwork4(const db::ServerSelector &server_selector, const SharedNetwork4Ptr &shared_network)=0
Creates or updates a shared network.
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, ClientClassesPtr client_classes=ClientClassesPtr())=0
Deletes pool level option.
virtual ~ConfigBackendDHCPv4()
Virtual destructor.
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.
virtual Subnet4Ptr getSubnet4(const db::ServerSelector &server_selector, const std::string &subnet_prefix) const =0
Retrieves a single subnet by subnet_prefix.
virtual db::ServerPtr getServer4(const data::ServerTag &server_tag) const =0
Retrieves a server.
virtual Subnet4Ptr getSubnet4(const db::ServerSelector &server_selector, const SubnetID &subnet_id) const =0
Retrieves a single subnet by subnet identifier.
virtual data::StampedValueCollection getAllGlobalParameters4(const db::ServerSelector &selector) const =0
Retrieves all global parameters.
virtual db::ServerCollection getAllServers4() const =0
Retrieves all servers.
virtual uint64_t deleteClientClass4(const db::ServerSelector &server_selector, const std::string &name)=0
Deletes DHCPv4 client class.
virtual uint64_t deleteSubnet4(const db::ServerSelector &server_selector, const std::string &subnet_prefix)=0
Deletes subnet by prefix.
virtual uint64_t deleteOptionDef4(const db::ServerSelector &server_selector, const uint16_t code, const std::string &space)=0
Deletes option definition.
virtual OptionContainer getAllOptions4(const db::ServerSelector &server_selector) const =0
Retrieves all global options.
virtual ClientClassDefPtr getClientClass4(const db::ServerSelector &selector, const std::string &name) const =0
Retrieves a client class by name.
virtual uint64_t deleteOption4(const db::ServerSelector &selector, const std::string &shared_network_name, const uint16_t code, const std::string &space, ClientClassesPtr client_classes=ClientClassesPtr())=0
Deletes shared network level option.
virtual data::StampedValuePtr getGlobalParameter4(const db::ServerSelector &selector, const std::string &name) const =0
Retrieves global parameter value.
virtual SharedNetwork4Collection getAllSharedNetworks4(const db::ServerSelector &server_selector) const =0
Retrieves all shared networks.
virtual uint64_t deleteSharedNetwork4(const db::ServerSelector &server_selector, const std::string &name)=0
Deletes shared network by name.
virtual Subnet4Collection getModifiedSubnets4(const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves subnets modified after specified time.
virtual void createUpdateOption4(const db::ServerSelector &server_selector, const OptionDescriptorPtr &option)=0
Creates or updates global option.
virtual void createUpdateOption4(const db::ServerSelector &server_selector, const SubnetID &subnet_id, const OptionDescriptorPtr &option)=0
Creates or updates subnet level option.
virtual OptionDefContainer getModifiedOptionDefs4(const db::ServerSelector &server_selector, const boost::posix_time::ptime &modification_time) const =0
Retrieves option definitions modified after specified time.
virtual uint64_t deleteAllSubnets4(const db::ServerSelector &server_selector)=0
Deletes all subnets.
virtual void createUpdateServer4(const db::ServerPtr &server)=0
Creates or updates a server.
virtual uint64_t deleteServer4(const data::ServerTag &server_tag)=0
Deletes a server from the backend.
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.
Defines classes for storing client class definitions.
boost::shared_ptr< StampedValue > StampedValuePtr
Pointer to the stamped value.
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::shared_ptr< Server > ServerPtr
Shared pointer to the Server class.
Definition server.h:22
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.
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:461
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 > >, boost::multi_index::hashed_non_unique< boost::multi_index::member< OptionDescriptor, bool, &OptionDescriptor::cancelled_ > >, boost::multi_index::hashed_non_unique< boost::multi_index::composite_key< OptionDescriptor, KeyFromKeyExtractor< boost::multi_index::const_mem_fun< Option, uint16_t, &Option::getType >, boost::multi_index::member< OptionDescriptor, OptionPtr, &OptionDescriptor::option_ > >, boost::multi_index::member< OptionDescriptor, ClientClasses, &OptionDescriptor::client_classes_ > > > > > OptionContainer
Multi index container for DHCP option descriptors.
Definition cfg_option.h:347
boost::shared_ptr< ClientClasses > ClientClassesPtr
Smart pointer to ClientClasses object.
Definition classify.h:281
boost::shared_ptr< ClientClassDef > ClientClassDefPtr
a pointer to an ClientClassDef
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
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:866
boost::shared_ptr< OptionDescriptor > OptionDescriptorPtr
A pointer to option descriptor.
Definition cfg_option.h:38
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition subnet_id.h:25
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.
boost::shared_ptr< ConfigBackendDHCPv4 > ConfigBackendDHCPv4Ptr
Shared pointer to the ConfigBackendDHCPv4 instance.
boost::shared_ptr< SharedNetwork4 > SharedNetwork4Ptr
Pointer to SharedNetwork4 object.
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.
Defines the logger used by the top-level component of kea-lfc.