| Kea 3.0.2-git

cfg_subnets6.h
Go to the documentation of this file.
1// Copyright (C) 2014-2024 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 CFG_SUBNETS6_H
8#define CFG_SUBNETS6_H
9
10#include <asiolink/io_address.h>
11#include <dhcp/option.h>
12#include <dhcp/pkt6.h>
13#include <cc/cfg_to_element.h>
14#include <dhcpsrv/cfg_shared_networks.h>
15#include <dhcpsrv/subnet.h>
16#include <dhcpsrv/subnet_id.h>
17#include <dhcpsrv/subnet_selector.h>
18#include <util/optional.h>
19#include <boost/shared_ptr.hpp>
20#include <string>
21
22 namespace isc {
23 namespace dhcp {
24
34 class CfgSubnets6 : public isc::data::CfgToElement {
35 public:
36
43 void add(const Subnet6Ptr& subnet);
44
53 Subnet6Ptr replace(const Subnet6Ptr& subnet);
54
60 void del(const ConstSubnet6Ptr& subnet);
61
67 void del(const SubnetID& subnet_id);
68
110 void merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks,
111 CfgSubnets6& other);
112
120 const Subnet6Collection* getAll() const {
121 return (&subnets_);
122 }
123
139 ConstSubnet6Ptr getBySubnetId(const SubnetID& subnet_id) const {
140 return (getSubnet(subnet_id));
141 }
142
158 ConstSubnet6Ptr getByPrefix(const std::string& subnet_prefix) const;
159
166 static SubnetSelector initSelector(const Pkt6Ptr& query);
167
204 ConstSubnet6Ptr selectSubnet(const SubnetSelector& selector) const;
205
211 Subnet6Ptr getSubnet(const SubnetID id) const;
212
246 ConstSubnet6Ptr
247 selectSubnet(const asiolink::IOAddress& address,
248 const ClientClasses& client_classes = ClientClasses(),
249 const bool is_relay_address = false) const;
250
260 SubnetIDSet getLinks(const asiolink::IOAddress& link_addr) const;
261
269 void updateStatistics();
270
277 void removeStatistics();
278
280 void initAllocatorsAfterConfigure();
281
283 void clear();
284
288 virtual isc::data::ElementPtr toElement() const;
289
290 private:
291
311 ConstSubnet6Ptr
312 selectSubnet(const std::string& iface_name,
313 const ClientClasses& client_classes) const;
314
336 ConstSubnet6Ptr
337 selectSubnet(const OptionPtr& interface_id,
338 const ClientClasses& client_classes) const;
339
341 Subnet6Collection subnets_;
342
343};
344
346
347
348 typedef boost::shared_ptr<CfgSubnets6> CfgSubnets6Ptr;
349
351 typedef boost::shared_ptr<const CfgSubnets6> ConstCfgSubnets6Ptr;
352
354
355}
356}
357
358#endif // CFG_SUBNETS6_H
cfg_shared_networks.h
cfg_to_element.h
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic).
Definition io_address.h:45
isc::dhcp::CfgSubnets6
Holds subnets configured for the DHCPv6 server.
Definition cfg_subnets6.h:34
isc::dhcp::CfgSubnets6::getLinks
SubnetIDSet getLinks(const asiolink::IOAddress &link_addr) const
Convert a link address into a link set.
Definition cfg_subnets6.cc:384
isc::dhcp::CfgSubnets6::selectSubnet
ConstSubnet6Ptr selectSubnet(const SubnetSelector &selector) const
Selects a subnet using parameters specified in the selector.
Definition cfg_subnets6.cc:228
isc::dhcp::CfgSubnets6::updateStatistics
void updateStatistics()
Updates statistics.
Definition cfg_subnets6.cc:483
isc::dhcp::CfgSubnets6::replace
Subnet6Ptr replace(const Subnet6Ptr &subnet)
Replaces subnet in the configuration.
Definition cfg_subnets6.cc:47
isc::dhcp::CfgSubnets6::toElement
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition cfg_subnets6.cc:586
isc::dhcp::CfgSubnets6::merge
void merge(CfgOptionDefPtr cfg_def, CfgSharedNetworks6Ptr networks, CfgSubnets6 &other)
Merges specified subnet configuration into this configuration.
Definition cfg_subnets6.cc:90
isc::dhcp::CfgSubnets6::getSubnet
Subnet6Ptr getSubnet(const SubnetID id) const
Returns subnet with specified subnet-id value.
Definition cfg_subnets6.cc:377
isc::dhcp::CfgSubnets6::removeStatistics
void removeStatistics()
Removes statistics.
Definition cfg_subnets6.cc:396
isc::dhcp::CfgSubnets6::getAll
const Subnet6Collection * getAll() const
Returns pointer to the collection of all IPv6 subnets.
Definition cfg_subnets6.h:120
isc::dhcp::CfgSubnets6::add
void add(const Subnet6Ptr &subnet)
Adds new subnet to the configuration.
Definition cfg_subnets6.cc:29
isc::dhcp::CfgSubnets6::clear
void clear()
Clears all subnets from the configuration.
Definition cfg_subnets6.cc:581
isc::dhcp::CfgSubnets6::initSelector
static SubnetSelector initSelector(const Pkt6Ptr &query)
Build selector from a client's message.
Definition cfg_subnets6.cc:202
isc::dhcp::CfgSubnets6::del
void del(const ConstSubnet6Ptr &subnet)
Removes subnet from the configuration.
Definition cfg_subnets6.cc:68
isc::dhcp::CfgSubnets6::getByPrefix
ConstSubnet6Ptr getByPrefix(const std::string &subnet_prefix) const
Returns const pointer to a subnet which matches the specified prefix in the canonical form.
Definition cfg_subnets6.cc:195
isc::dhcp::CfgSubnets6::initAllocatorsAfterConfigure
void initAllocatorsAfterConfigure()
Calls initAllocatorsAfterConfigure for each subnet.
Definition cfg_subnets6.cc:574
isc::dhcp::CfgSubnets6::getBySubnetId
ConstSubnet6Ptr getBySubnetId(const SubnetID &subnet_id) const
Returns const pointer to a subnet identified by the specified subnet identifier.
Definition cfg_subnets6.h:139
isc::dhcp::ClientClasses
Container for storing client class names.
Definition classify.h:109
io_address.h
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::ConstSubnet6Ptr
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
Definition subnet.h:623
isc::dhcp::CfgOptionDefPtr
boost::shared_ptr< CfgOptionDef > CfgOptionDefPtr
Non-const pointer.
Definition cfg_option_def.h:186
isc::dhcp::Subnet6Ptr
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
Definition subnet.h:626
isc::dhcp::Subnet6Collection
boost::multi_index_container< Subnet6Ptr, 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< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > > > Subnet6Collection
A collection of Subnet6 objects.
Definition subnet.h:937
isc::dhcp::CfgSubnets6Ptr
boost::shared_ptr< CfgSubnets6 > CfgSubnets6Ptr
Non-const pointer.
Definition cfg_subnets6.h:348
isc::dhcp::CfgSharedNetworks6Ptr
boost::shared_ptr< CfgSharedNetworks6 > CfgSharedNetworks6Ptr
Pointer to the configuration of IPv6 shared networks.
Definition cfg_shared_networks.h:240
isc::dhcp::SubnetID
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition subnet_id.h:25
isc::dhcp::ConstCfgSubnets6Ptr
boost::shared_ptr< const CfgSubnets6 > ConstCfgSubnets6Ptr
Const pointer.
Definition cfg_subnets6.h:351
isc::dhcp::Pkt6Ptr
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
Definition pkt6.h:31
isc::dhcp::OptionPtr
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
option.h
optional.h
pkt6.h
isc::data::CfgToElement
Abstract class for configuration Cfg_* classes.
Definition cfg_to_element.h:29
isc::dhcp::SubnetSelector
Subnet selector used to specify parameters used to select a subnet.
Definition subnet_selector.h:23
subnet.h
subnet_id.h
subnet_selector.h