Kea 1.5.0
cfg_subnets4.h
Go to the documentation of this file.
1// Copyright (C) 2014-2018 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_SUBNETS4_H
8#define CFG_SUBNETS4_H
9
10#include <asiolink/io_address.h>
11#include <cc/cfg_to_element.h>
12#include <dhcp/pkt4.h>
13#include <dhcpsrv/subnet.h>
14#include <dhcpsrv/subnet_id.h>
16#include <boost/shared_ptr.hpp>
17#include <string>
18
19namespace isc {
20namespace dhcp {
21
33public:
34
41 void add(const Subnet4Ptr& subnet);
42
48 void del(const ConstSubnet4Ptr& subnet);
49
57 const Subnet4Collection* getAll() const {
58 return (&subnets_);
59 }
60
76 ConstSubnet4Ptr getBySubnetId(const SubnetID& subnet_id) const;
77
93 ConstSubnet4Ptr getByPrefix(const std::string& subnet_prefix) const;
94
101 bool hasSubnetWithServerId(const asiolink::IOAddress& server_id) const;
102
109 static SubnetSelector initSelector(const Pkt4Ptr& query);
110
158 Subnet4Ptr selectSubnet(const SubnetSelector& selector) const;
159
166 Subnet4Ptr getSubnet(const SubnetID id) const;
167
189 const ClientClasses& client_classes
190 = ClientClasses()) const;
191
213 Subnet4Ptr selectSubnet(const std::string& iface,
214 const ClientClasses& client_classes) const;
215
236 selectSubnet4o6(const SubnetSelector& selector) const;
237
245 void updateStatistics();
246
253 void removeStatistics();
254
258 virtual isc::data::ElementPtr toElement() const;
259
260private:
261
263 Subnet4Collection subnets_;
264
265};
266
268
269
270typedef boost::shared_ptr<CfgSubnets4> CfgSubnets4Ptr;
271
273typedef boost::shared_ptr<const CfgSubnets4> ConstCfgSubnets4Ptr;
274
276
277}
278}
279
280#endif // CFG_SUBNETS4_H
Holds subnets configured for the DHCPv4 server.
Definition: cfg_subnets4.h:32
ConstSubnet4Ptr getBySubnetId(const SubnetID &subnet_id) const
Returns const pointer to a subnet identified by the specified subnet identifier.
Definition: cfg_subnets4.cc:59
void del(const ConstSubnet4Ptr &subnet)
Removes subnet from the configuration.
Definition: cfg_subnets4.cc:45
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
bool hasSubnetWithServerId(const asiolink::IOAddress &server_id) const
Checks if specified server identifier has been specified for any subnet.
Definition: cfg_subnets4.cc:73
ConstSubnet4Ptr getByPrefix(const std::string &subnet_prefix) const
Returns const pointer to a subnet which matches the specified prefix in the canonical form.
Definition: cfg_subnets4.cc:66
void updateStatistics()
Updates statistics.
Subnet4Ptr selectSubnet4o6(const SubnetSelector &selector) const
Attempts to do subnet selection based on DHCP4o6 information.
Subnet4Ptr selectSubnet(const SubnetSelector &selector) const
Returns a pointer to the selected subnet.
Subnet4Ptr getSubnet(const SubnetID id) const
Returns subnet with specified subnet-id value.
void add(const Subnet4Ptr &subnet)
Adds new subnet to the configuration.
Definition: cfg_subnets4.cc:27
void removeStatistics()
Removes statistics.
const Subnet4Collection * getAll() const
Returns pointer to the collection of all IPv4 subnets.
Definition: cfg_subnets4.h:57
static SubnetSelector initSelector(const Pkt4Ptr &query)
Build selector from a client's message.
Definition: cfg_subnets4.cc:80
Container for storing client class names.
Definition: classify.h:43
boost::shared_ptr< Element > ElementPtr
Definition: data.h:22
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition: subnet.h:464
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
Definition: subnet.h:461
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition: pkt4.h:546
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
Definition: lease.h:24
boost::shared_ptr< CfgSubnets4 > CfgSubnets4Ptr
Non-const pointer.
Definition: cfg_subnets4.h:270
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< SubnetRandomAccessIndexTag > >, 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 > > > > Subnet4Collection
A collection of Subnet4 objects.
Definition: subnet.h:798
boost::shared_ptr< const CfgSubnets4 > ConstCfgSubnets4Ptr
Const pointer.
Definition: cfg_subnets4.h:273
Defines the logger used by the top-level component of kea-dhcp-ddns.
Abstract class for configuration Cfg_* classes.
Subnet selector used to specify parameters used to select a subnet.