Kea  2.3.5-git
host_reservations_list_parser.h
Go to the documentation of this file.
1 // Copyright (C) 2014-2017 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 HOST_RESERVATIONS_LIST_PARSER_H
8 #define HOST_RESERVATIONS_LIST_PARSER_H
9 
10 #include <cc/data.h>
11 #include <cc/simple_parser.h>
12 #include <dhcpsrv/host.h>
13 #include <dhcpsrv/subnet_id.h>
14 #include <boost/foreach.hpp>
15 
16 namespace isc {
17 namespace dhcp {
18 
24 template<typename HostReservationParserType>
26 public:
27 
39  void parse(const SubnetID& subnet_id, isc::data::ConstElementPtr hr_list,
40  HostCollection& hosts_list) {
41  HostCollection hosts;
42  BOOST_FOREACH(data::ConstElementPtr reservation, hr_list->listValue()) {
43  HostReservationParserType parser;
44  hosts.push_back(parser.parse(subnet_id, reservation));
45  }
46  hosts_list.swap(hosts);
47  }
48 };
49 
50 }
51 }
52 
53 #endif // HOST_RESERVATIONS_LIST_PARSER_H
std::vector< HostPtr > HostCollection
Collection of the Host objects.
Definition: host.h:810
void parse(const SubnetID &subnet_id, isc::data::ConstElementPtr hr_list, HostCollection &hosts_list)
Parses a list of host reservation entries for a subnet.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
Defines the logger used by the top-level component of kea-lfc.
Parser for a list of host reservations for a subnet.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition: subnet_id.h:25