Kea  1.5.0
cfg_subnets6.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_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/subnet.h>
15 #include <dhcpsrv/subnet_id.h>
17 #include <util/optional_value.h>
18 #include <boost/shared_ptr.hpp>
19 #include <string>
20 
21 namespace isc {
22 namespace dhcp {
23 
34 public:
35 
42  void add(const Subnet6Ptr& subnet);
43 
49  void del(const ConstSubnet6Ptr& subnet);
50 
58  const Subnet6Collection* getAll() const {
59  return (&subnets_);
60  }
61 
77  ConstSubnet6Ptr getBySubnetId(const SubnetID& subnet_id) const;
78 
94  ConstSubnet6Ptr getByPrefix(const std::string& subnet_prefix) const;
95 
102  static SubnetSelector initSelector(const Pkt6Ptr& query);
103 
140  Subnet6Ptr selectSubnet(const SubnetSelector& selector) const;
141 
148  Subnet6Ptr getSubnet(const SubnetID id) const;
149 
183  Subnet6Ptr
184  selectSubnet(const asiolink::IOAddress& address,
185  const ClientClasses& client_classes = ClientClasses(),
186  const bool is_relay_address = false) const;
187 
195  void updateStatistics();
196 
203  void removeStatistics();
204 
208  virtual isc::data::ElementPtr toElement() const;
209 
210 private:
211 
231  Subnet6Ptr
232  selectSubnet(const std::string& iface_name,
233  const ClientClasses& client_classes) const;
234 
256  Subnet6Ptr
257  selectSubnet(const OptionPtr& interface_id,
258  const ClientClasses& client_classes) const;
259 
261  Subnet6Collection subnets_;
262 
263 };
264 
266 
267 typedef boost::shared_ptr<CfgSubnets6> CfgSubnets6Ptr;
269 
271 typedef boost::shared_ptr<const CfgSubnets6> ConstCfgSubnets6Ptr;
272 
274 
275 }
276 }
277 
278 #endif // CFG_SUBNETS6_H
isc::dhcp::Subnet6Collection
boost::multi_index_container< Subnet6Ptr, 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 > > >> Subnet6Collection
A collection of Subnet6 objects.
Definition: subnet.h:843
optional_value.h
isc::dhcp::CfgSubnets6
Holds subnets configured for the DHCPv6 server.
Definition: cfg_subnets6.h:33
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.cc:59
isc::dhcp::CfgSubnets6::selectSubnet
Subnet6Ptr selectSubnet(const SubnetSelector &selector) const
Selects a subnet using parameters specified in the selector.
Definition: cfg_subnets6.cc:99
io_address.h
isc::data::CfgToElement
Abstract class for configuration Cfg_* classes.
Definition: cfg_to_element.h:29
pkt6.h
isc::dhcp::ConstSubnet6Ptr
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
Definition: subnet.h:623
isc::dhcp::SubnetSelector
Subnet selector used to specify parameters used to select a subnet.
Definition: subnet_selector.h:23
isc::dhcp::CfgSubnets6::del
void del(const ConstSubnet6Ptr &subnet)
Removes subnet from the configuration.
Definition: cfg_subnets6.cc:45
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
subnet_selector.h
isc::dhcp::CfgSubnets6::toElement
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: cfg_subnets6.cc:303
subnet.h
isc::dhcp::CfgSubnets6::updateStatistics
void updateStatistics()
Updates statistics.
Definition: cfg_subnets6.cc:276
isc::dhcp::CfgSubnets6::removeStatistics
void removeStatistics()
Removes statistics.
Definition: cfg_subnets6.cc:246
cfg_to_element.h
isc::dhcp::CfgSubnets6::initSelector
static SubnetSelector initSelector(const Pkt6Ptr &query)
Build selector from a client's message.
Definition: cfg_subnets6.cc:73
isc::dhcp::CfgSubnets6::add
void add(const Subnet6Ptr &subnet)
Adds new subnet to the configuration.
Definition: cfg_subnets6.cc:27
isc::dhcp::CfgSubnets6::getSubnet
Subnet6Ptr getSubnet(const SubnetID id) const
Returns subnet with specified subnet-id value.
Definition: cfg_subnets6.cc:233
isc::dhcp::ConstCfgSubnets6Ptr
boost::shared_ptr< const CfgSubnets6 > ConstCfgSubnets6Ptr
Const pointer.
Definition: cfg_subnets6.h:271
isc::dhcp::Subnet6Ptr
boost::shared_ptr< Subnet6 > Subnet6Ptr
A pointer to a Subnet6 object.
Definition: subnet.h:629
isc::dhcp::OptionPtr
boost::shared_ptr< Option > OptionPtr
Definition: option.h:37
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
option.h
isc::dhcp::CfgSubnets6::getAll
const Subnet6Collection * getAll() const
Returns pointer to the collection of all IPv6 subnets.
Definition: cfg_subnets6.h:58
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:66
isc::dhcp::Pkt6Ptr
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
Definition: pkt6.h:28
isc::dhcp::ClientClasses
Container for storing client class names.
Definition: classify.h:43
isc::dhcp::CfgSubnets6Ptr
boost::shared_ptr< CfgSubnets6 > CfgSubnets6Ptr
Non-const pointer.
Definition: cfg_subnets6.h:268