Kea 1.5.0
option_data_parser.h
Go to the documentation of this file.
1// Copyright (C) 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 OPTION_DATA_PARSER_H
8#define OPTION_DATA_PARSER_H
9
10#include <cc/data.h>
11#include <cc/simple_parser.h>
13#include <dhcpsrv/cfg_option.h>
15#include <util/optional_value.h>
16#include <cstdint>
17#include <string>
18#include <utility>
19
20namespace isc {
21namespace dhcp {
22
42public:
47 OptionDataParser(const uint16_t address_family,
48 CfgOptionDefPtr cfg_option_def = CfgOptionDefPtr());
49
65 std::pair<OptionDescriptor, std::string>
66 parse(isc::data::ConstElementPtr single_option);
67private:
68
84 template<typename SearchKey>
85 OptionDefinitionPtr findOptionDefinition(const std::string& option_space,
86 const SearchKey& search_key) const;
87
101 std::pair<OptionDescriptor, std::string>
102 createOption(isc::data::ConstElementPtr option_data);
103
111 extractCode(data::ConstElementPtr parent) const;
112
120 extractName(data::ConstElementPtr parent) const;
121
125 util::OptionalValue<bool> extractCSVFormat(data::ConstElementPtr parent) const;
126
132 std::string extractData(data::ConstElementPtr parent) const;
133
143 std::string extractSpace(data::ConstElementPtr parent) const;
144
148 util::OptionalValue<bool> extractPersistent(data::ConstElementPtr parent) const;
149
151 uint16_t address_family_;
152
154 CfgOptionDefPtr cfg_option_def_;
155};
156
164public:
169 OptionDataListParser(const uint16_t address_family,
170 CfgOptionDefPtr cfg_option_def = CfgOptionDefPtr());
171
180 void parse(const CfgOptionPtr& cfg,
181 isc::data::ConstElementPtr option_data_list);
182private:
184 uint16_t address_family_;
185
187 CfgOptionDefPtr cfg_option_def_;
188};
189
190
191} // end of namespace isc::dhcp
192} // end of namespace isc
193
194#endif // OPTION_DATA_PARSER_H
Parser for option data values within a subnet.
void parse(const CfgOptionPtr &cfg, isc::data::ConstElementPtr option_data_list)
Parses a list of options, instantiates them and stores in cfg.
Parser for option data value.
std::pair< OptionDescriptor, std::string > parse(isc::data::ConstElementPtr single_option)
Parses ElementPtr containing option definition.
Simple class representing an optional value.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
boost::shared_ptr< CfgOption > CfgOptionPtr
Non-const pointer.
Definition: cfg_option.h:497
boost::shared_ptr< CfgOptionDef > CfgOptionDefPtr
Non-const pointer.
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
Defines the logger used by the top-level component of kea-dhcp-ddns.