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 
19 namespace isc {
20 namespace dhcp {
21 
33 public:
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 
235  Subnet4Ptr
236  selectSubnet4o6(const SubnetSelector& selector) const;
237 
245  void updateStatistics();
246 
253  void removeStatistics();
254 
258  virtual isc::data::ElementPtr toElement() const;
259 
260 private:
261 
263  Subnet4Collection subnets_;
264 
265 };
266 
268 
269 typedef boost::shared_ptr<CfgSubnets4> CfgSubnets4Ptr;
271 
273 typedef boost::shared_ptr<const CfgSubnets4> ConstCfgSubnets4Ptr;
274 
276 
277 }
278 }
279 
280 #endif // CFG_SUBNETS4_H
pkt4.h
isc::dhcp::CfgSubnets4::add
void add(const Subnet4Ptr &subnet)
Adds new subnet to the configuration.
Definition: cfg_subnets4.cc:27
isc::dhcp::CfgSubnets4::selectSubnet4o6
Subnet4Ptr selectSubnet4o6(const SubnetSelector &selector) const
Attempts to do subnet selection based on DHCP4o6 information.
Definition: cfg_subnets4.cc:128
io_address.h
isc::data::CfgToElement
Abstract class for configuration Cfg_* classes.
Definition: cfg_to_element.h:29
isc::dhcp::CfgSubnets4Ptr
boost::shared_ptr< CfgSubnets4 > CfgSubnets4Ptr
Non-const pointer.
Definition: cfg_subnets4.h:270
isc::dhcp::SubnetSelector
Subnet selector used to specify parameters used to select a subnet.
Definition: subnet_selector.h:23
isc::dhcp::CfgSubnets4::getSubnet
Subnet4Ptr getSubnet(const SubnetID id) const
Returns subnet with specified subnet-id value.
Definition: cfg_subnets4.cc:311
isc::dhcp::CfgSubnets4::initSelector
static SubnetSelector initSelector(const Pkt4Ptr &query)
Build selector from a client's message.
Definition: cfg_subnets4.cc:80
isc::dhcp::CfgSubnets4::getByPrefix
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
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::dhcp::CfgSubnets4::getAll
const Subnet4Collection * getAll() const
Returns pointer to the collection of all IPv4 subnets.
Definition: cfg_subnets4.h:57
isc::dhcp::Pkt4Ptr
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition: pkt4.h:546
subnet_selector.h
isc::dhcp::CfgSubnets4
Holds subnets configured for the DHCPv4 server.
Definition: cfg_subnets4.h:32
isc::dhcp::CfgSubnets4::toElement
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: cfg_subnets4.cc:396
subnet.h
isc::dhcp::Subnet4Ptr
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
Definition: subnet.h:464
isc::dhcp::ConstSubnet4Ptr
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
Definition: subnet.h:458
cfg_to_element.h
isc::dhcp::CfgSubnets4::selectSubnet
Subnet4Ptr selectSubnet(const SubnetSelector &selector) const
Returns a pointer to the selected subnet.
Definition: cfg_subnets4.cc:170
isc::dhcp::CfgSubnets4::hasSubnetWithServerId
bool hasSubnetWithServerId(const asiolink::IOAddress &server_id) const
Checks if specified server identifier has been specified for any subnet.
Definition: cfg_subnets4.cc:73
isc::dhcp::CfgSubnets4::del
void del(const ConstSubnet4Ptr &subnet)
Removes subnet from the configuration.
Definition: cfg_subnets4.cc:45
isc::dhcp::CfgSubnets4::updateStatistics
void updateStatistics()
Updates statistics.
Definition: cfg_subnets4.cc:374
subnet_id.h
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition: data.h:20
isc::dhcp::SubnetID
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
Definition: lease.h:24
isc::dhcp::ConstCfgSubnets4Ptr
boost::shared_ptr< const CfgSubnets4 > ConstCfgSubnets4Ptr
Const pointer.
Definition: cfg_subnets4.h:273
isc::dhcp::ClientClasses
Container for storing client class names.
Definition: classify.h:43
isc::dhcp::Subnet4Collection
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
isc::dhcp::CfgSubnets4::getBySubnetId
ConstSubnet4Ptr getBySubnetId(const SubnetID &subnet_id) const
Returns const pointer to a subnet identified by the specified subnet identifier.
Definition: cfg_subnets4.cc:59
isc::dhcp::CfgSubnets4::removeStatistics
void removeStatistics()
Removes statistics.
Definition: cfg_subnets4.cc:348