| Kea 3.0.2-git

adaptor_config.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 ISC_ADAPTOR_CONFIG_H
8#define ISC_ADAPTOR_CONFIG_H 1
9
10#include <dhcpsrv/subnet_id.h>
11#include <yang/adaptor_host.h>
12#include <yang/adaptor_option.h>
13#include <yang/adaptor_pool.h>
14#include <yang/adaptor_subnet.h>
15
16 namespace isc {
17 namespace yang {
18
25 class AdaptorConfig : public AdaptorHost, public AdaptorOption,
26 public AdaptorSubnet {
27 public:
38 static void preProcess4(isc::data::ElementPtr config);
39
50 static void preProcess6(isc::data::ElementPtr config);
51
52 protected:
63 static bool subnetsCollectID(isc::data::ConstElementPtr subnets,
64 isc::dhcp::SubnetIDSet& set);
65
77 static bool sharedNetworksCollectID(isc::data::ConstElementPtr networks,
78 isc::dhcp::SubnetIDSet& set,
79 const std::string& subsel);
80
89 static void subnetsAssignID(isc::data::ConstElementPtr subnets,
90 isc::dhcp::SubnetIDSet& set,
91 isc::dhcp::SubnetID& next);
92
102 static void sharedNetworksAssignID(isc::data::ConstElementPtr networks,
103 isc::dhcp::SubnetIDSet& set,
104 isc::dhcp::SubnetID& next,
105 const std::string& subsel);
106
113 static void sanitizePools(isc::data::ConstElementPtr pools);
114
118 static void sanitizePoolsInSubnets(isc::data::ConstElementPtr subnets);
119
124 static void sanitizePoolsInSharedNetworks(isc::data::ConstElementPtr networks,
125 const std::string& subsel);
126
135 static void sanitizeOptionDefList(isc::data::ConstElementPtr defs,
136 const std::string& space,
137 OptionCodes& codes);
138
144 static void sanitizeOptionDataList(isc::data::ConstElementPtr options,
145 const std::string& space,
146 const OptionCodes& codes);
147
154 static void sanitizeOptionClasses(isc::data::ConstElementPtr classes,
155 const std::string& space,
156 OptionCodes& codes);
157
163 static void sanitizeOptionPools(isc::data::ConstElementPtr pools,
164 const std::string& space,
165 const OptionCodes& codes);
166
172 static void sanitizeOptionHosts(isc::data::ConstElementPtr hosts,
173 const std::string& space,
174 const OptionCodes& codes);
175
181 static void sanitizeOptionSubnets(isc::data::ConstElementPtr subnets,
182 const std::string& space,
183 const OptionCodes& codes);
184
190 static void sanitizeOptionSharedNetworks(isc::data::ConstElementPtr networks,
191 const std::string& space,
192 const OptionCodes& codes);
193
204 static void sanitizeEmptyListPools(isc::data::ConstElementPtr pools);
205
216 static void sanitizeEmptyListSubnets(isc::data::ConstElementPtr subnets);
217
229 static void sanitizeEmptyListSharedNetworks(isc::data::ConstElementPtr networks,
230 const std::string& subsel);
231
237 static void sanitizeHostList(isc::data::ConstElementPtr hosts);
238
244 static void sanitizeHostSubnets(isc::data::ConstElementPtr subnets);
245
252 static void SanitizeHostsInSharedNetworks(isc::data::ConstElementPtr networks,
253 const std::string& space);
254
260 static void sanitizeRelaySubnets(isc::data::ConstElementPtr subnets);
261
268 static void sanitizeRelayInSharedNetworks(isc::data::ConstElementPtr networks,
269 const std::string& subsel);
270
276 static void sanitizeDatabase(isc::data::ElementPtr dhcp);
277
283 static void sanitizeRelaySuppliedOptions(isc::data::ElementPtr dhcp);
284
293 static void preProcess(isc::data::ElementPtr dhcp,
294 const std::string& subsel,
295 const std::string& space);
296}; // AdaptorConfig
297
298} // namespace yang
299} // namespace isc
300
301#endif // ISC_ADAPTOR_CONFIG_H
adaptor_host.h
adaptor_option.h
adaptor_pool.h
adaptor_subnet.h
isc::yang::AdaptorConfig
JSON adaptor for Kea server configurations.
Definition adaptor_config.h:26
isc::yang::AdaptorConfig::subnetsAssignID
static void subnetsAssignID(isc::data::ConstElementPtr subnets, isc::dhcp::SubnetIDSet &set, isc::dhcp::SubnetID &next)
Assigns subnet-id to every subnet in a subnet list.
Definition adaptor_config.cc:80
isc::yang::AdaptorConfig::sanitizeOptionSharedNetworks
static void sanitizeOptionSharedNetworks(isc::data::ConstElementPtr networks, const std::string &space, const OptionCodes &codes)
Set missing option codes to a shared network list.
Definition adaptor_config.cc:336
isc::yang::AdaptorConfig::sharedNetworksAssignID
static void sharedNetworksAssignID(isc::data::ConstElementPtr networks, isc::dhcp::SubnetIDSet &set, isc::dhcp::SubnetID &next, const std::string &subsel)
Assigns subnet-id to every subnet in a shared network list.
Definition adaptor_config.cc:94
isc::yang::AdaptorConfig::sanitizeEmptyListPools
static void sanitizeEmptyListPools(isc::data::ConstElementPtr pools)
Process empty lists in a pool list.
Definition adaptor_config.cc:377
isc::yang::AdaptorConfig::sanitizeEmptyListSharedNetworks
static void sanitizeEmptyListSharedNetworks(isc::data::ConstElementPtr networks, const std::string &subsel)
Process empty lists in a shared-network list.
Definition adaptor_config.cc:435
isc::yang::AdaptorConfig::sanitizeRelaySubnets
static void sanitizeRelaySubnets(isc::data::ConstElementPtr subnets)
Sanitizes relay information in subnets in a subnet list.
Definition adaptor_config.cc:509
isc::yang::AdaptorConfig::sanitizeHostSubnets
static void sanitizeHostSubnets(isc::data::ConstElementPtr subnets)
Process host reservations in a subnet list.
Definition adaptor_config.cc:479
isc::yang::AdaptorConfig::subnetsCollectID
static bool subnetsCollectID(isc::data::ConstElementPtr subnets, isc::dhcp::SubnetIDSet &set)
Collects subnet-ids on all subnets.
Definition adaptor_config.cc:25
isc::yang::AdaptorConfig::preProcess4
static void preProcess4(isc::data::ElementPtr config)
Pre process a DHCPv4 configuration.
Definition adaptor_config.cc:653
isc::yang::AdaptorConfig::sanitizeOptionPools
static void sanitizeOptionPools(isc::data::ConstElementPtr pools, const std::string &space, const OptionCodes &codes)
Set missing option codes to a pool list.
Definition adaptor_config.cc:238
isc::yang::AdaptorConfig::preProcess
static void preProcess(isc::data::ElementPtr dhcp, const std::string &subsel, const std::string &space)
Pre process a configuration.
Definition adaptor_config.cc:561
isc::yang::AdaptorConfig::sanitizePoolsInSubnets
static void sanitizePoolsInSubnets(isc::data::ConstElementPtr subnets)
Sanitizes all pools in a subnets list.
Definition adaptor_config.cc:131
isc::yang::AdaptorConfig::sanitizeDatabase
static void sanitizeDatabase(isc::data::ElementPtr dhcp)
Update (hosts) database.
Definition adaptor_config.cc:537
isc::yang::AdaptorConfig::sanitizeOptionHosts
static void sanitizeOptionHosts(isc::data::ConstElementPtr hosts, const std::string &space, const OptionCodes &codes)
Set missing option codes to a host reservation list.
Definition adaptor_config.cc:259
isc::yang::AdaptorConfig::sanitizeHostList
static void sanitizeHostList(isc::data::ConstElementPtr hosts)
Process host reservation list.
Definition adaptor_config.cc:465
isc::yang::AdaptorConfig::SanitizeHostsInSharedNetworks
static void SanitizeHostsInSharedNetworks(isc::data::ConstElementPtr networks, const std::string &space)
Process host reservations in a shared network list.
Definition adaptor_config.cc:492
isc::yang::AdaptorConfig::sanitizeOptionDefList
static void sanitizeOptionDefList(isc::data::ConstElementPtr defs, const std::string &space, OptionCodes &codes)
Collect option definitions from an option definition list.
Definition adaptor_config.cc:156
isc::yang::AdaptorConfig::sanitizeEmptyListSubnets
static void sanitizeEmptyListSubnets(isc::data::ConstElementPtr subnets)
Process empty lists in a subnet list.
Definition adaptor_config.cc:405
isc::yang::AdaptorConfig::sanitizeOptionSubnets
static void sanitizeOptionSubnets(isc::data::ConstElementPtr subnets, const std::string &space, const OptionCodes &codes)
Set missing option codes to a subnet list.
Definition adaptor_config.cc:280
isc::yang::AdaptorConfig::sanitizePools
static void sanitizePools(isc::data::ConstElementPtr pools)
Sanitizes all pools in a pools list.
Definition adaptor_config.cc:116
isc::yang::AdaptorConfig::sanitizePoolsInSharedNetworks
static void sanitizePoolsInSharedNetworks(isc::data::ConstElementPtr networks, const std::string &subsel)
Sanitizes all pools in all subnets in a shared network list.
Definition adaptor_config.cc:143
isc::yang::AdaptorConfig::sanitizeOptionClasses
static void sanitizeOptionClasses(isc::data::ConstElementPtr classes, const std::string &space, OptionCodes &codes)
Collect option definitions from a client class list and set missing option codes.
Definition adaptor_config.cc:198
isc::yang::AdaptorConfig::preProcess6
static void preProcess6(isc::data::ElementPtr config)
Pre process a DHCPv6 configuration.
Definition adaptor_config.cc:673
isc::yang::AdaptorConfig::sanitizeRelaySuppliedOptions
static void sanitizeRelaySuppliedOptions(isc::data::ElementPtr dhcp)
Update relay supplied options.
Definition adaptor_config.cc:551
isc::yang::AdaptorConfig::sanitizeOptionDataList
static void sanitizeOptionDataList(isc::data::ConstElementPtr options, const std::string &space, const OptionCodes &codes)
Set missing option codes to an option data list.
Definition adaptor_config.cc:176
isc::yang::AdaptorConfig::sanitizeRelayInSharedNetworks
static void sanitizeRelayInSharedNetworks(isc::data::ConstElementPtr networks, const std::string &subsel)
Sanitizes relay information in a shared network list.
Definition adaptor_config.cc:522
isc::yang::AdaptorConfig::sharedNetworksCollectID
static bool sharedNetworksCollectID(isc::data::ConstElementPtr networks, isc::dhcp::SubnetIDSet &set, const std::string &subsel)
Collects subnet-ids in all subnets in all shared network list.
Definition adaptor_config.cc:47
isc::yang::AdaptorHost
JSON adaptor for host reservations quoting identifiers.
Definition adaptor_host.h:21
isc::yang::AdaptorOption
JSON adaptor for option data or definition setting defaults.
Definition adaptor_option.h:40
isc::yang::AdaptorSubnet
JSON adaptor for subnets adding IDs and canonizes relays.
Definition adaptor_subnet.h:25
isc::config
Definition command_interpreter.cc:23
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::SubnetIDSet
std::set< dhcp::SubnetID > SubnetIDSet
Ordered list aka set of subnetIDs.
Definition subnet_id.h:43
isc::dhcp::SubnetID
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition subnet_id.h:25
isc::yang
Definition adaptor.cc:17
isc::yang::OptionCodes
std::unordered_map< std::string, uint16_t > OptionCodes
Map for DHCP option definitions handling code and an index built from space and name.
Definition adaptor_option.h:23
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
subnet_id.h