Kea 1.5.0
config_ctl_parser.cc
Go to the documentation of this file.
1// Copyright (C) 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#include <config.h>
8
12#include <string>
13
14using namespace isc;
15using namespace isc::data;
16
17namespace isc {
18namespace process {
19
23
24 try {
25 if (config_control->contains("config-databases")) {
26
27 auto elem = config_control->get("config-databases");
28 if (elem->getType() != Element::list) {
29 isc_throw (ConfigError, "config-databases must be a list ("
30 << elem->getPosition() << ")");
31 }
32
33 const std::vector<data::ElementPtr>& db_list = elem->listValue();
34 for (auto db = db_list.cbegin(); db != db_list.end(); ++db) {
35 db::DbAccessParser parser;
36 std::string access_string;
37 parser.parse(access_string, *db);
41 ctl_info->addConfigDatabase(access_string);
42 }
43 }
44 } catch (const isc::ConfigError&) {
45 // Position was already added
46 throw;
47 } catch (const std::exception& ex) {
48 isc_throw(ConfigError, ex.what() << " ("
49 << config_control->getPosition() << ")");
50 }
51
52 return (ctl_info);
53}
54
55} // end of namespace isc::process
56} // end of namespace isc
57
An exception that is thrown if an error occurs while configuring any server.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Parse Database Parameters.
void parse(std::string &access_string, isc::data::ConstElementPtr database_config)
Parse configuration value.
Embodies configuration information used during a server's configuration process.
ConfigControlInfoPtr parse(const data::ConstElementPtr &config_control)
Parses a configuration control Element.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
boost::shared_ptr< ConfigControlInfo > ConfigControlInfoPtr
Defines a pointer to a ConfigControlInfo.
Defines the logger used by the top-level component of kea-dhcp-ddns.