Kea 2.6.0
host_reservations_list_parser.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 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
15namespace isc {
16namespace dhcp {
17
23template<typename HostReservationParserType>
25public:
26
38 void parse(const SubnetID& subnet_id, isc::data::ConstElementPtr hr_list,
39 HostCollection& hosts_list) {
40 HostCollection hosts;
41 for (auto const& reservation : hr_list->listValue()) {
42 HostReservationParserType parser;
43 hosts.push_back(parser.parse(subnet_id, reservation));
44 }
45 hosts_list.swap(hosts);
46 }
47};
48
49}
50}
51
52#endif // HOST_RESERVATIONS_LIST_PARSER_H
Parser for a list of host reservations for a subnet.
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:29
std::vector< HostPtr > HostCollection
Collection of the Host objects.
Definition: host.h:816
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition: subnet_id.h:25
Defines the logger used by the top-level component of kea-lfc.