From: Tomek Mrugalski Date: Wed, 8 Feb 2017 15:00:01 +0000 (+0100) Subject: [5110] Minor corrections during review. X-Git-Tag: trac1205_base^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8b0701f28bc3bb01e191a8582e3bf76f6e45ee90;p=thirdparty%2Fkea.git [5110] Minor corrections during review. --- diff --git a/src/bin/d2/d2_cfg_mgr.cc b/src/bin/d2/d2_cfg_mgr.cc index 22d331eded..a7e49a3df5 100644 --- a/src/bin/d2/d2_cfg_mgr.cc +++ b/src/bin/d2/d2_cfg_mgr.cc @@ -284,7 +284,7 @@ D2CfgMgr::parseElement(const std::string& element_id, << element_id << element->getPosition()); } } catch (const D2CfgError& ex) { - // Should already have a specific error and postion info + // Should already have a specific error and position info throw ex; } catch (const std::exception& ex) { isc_throw(D2CfgError, "element: " << element_id << " : " << ex.what() diff --git a/src/bin/d2/d2_cfg_mgr.h b/src/bin/d2/d2_cfg_mgr.h index a557161fe1..004dd45004 100644 --- a/src/bin/d2/d2_cfg_mgr.h +++ b/src/bin/d2/d2_cfg_mgr.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -83,7 +83,7 @@ public: return (keys_); } - /// @brief Sets the mapy of TSIG keys + /// @brief Sets the map of TSIG keys /// /// @param pointer to the new TSIG key map void setKeys(const TSIGKeyInfoMapPtr& keys) { diff --git a/src/bin/d2/d2_config.h b/src/bin/d2/d2_config.h index e2a6b2d090..c8a6d79bb9 100644 --- a/src/bin/d2/d2_config.h +++ b/src/bin/d2/d2_config.h @@ -729,19 +729,13 @@ private: /// @brief Defines a pointer for DScalarContext instances. typedef boost::shared_ptr DScalarContextPtr; -/// @brief Parser for TSIGKeyInfo +/// @brief Parser for TSIGKeyInfo /// /// This class parses the configuration element "tsig-key" defined in /// src/bin/d2/dhcp-ddns.spec and creates an instance of a TSIGKeyInfo. class TSIGKeyInfoParser : public data::SimpleParser { public: - /// @brief Constructor - TSIGKeyInfoParser(){}; - - /// @brief Destructor - virtual ~TSIGKeyInfoParser(){}; - - /// @brief Performs the actual parsing of the given "tsig-key" element. + /// @brief Performs the actual parsing of the given "tsig-key" element. /// /// Parses a configuration for the elements needed to instantiate a /// TSIGKeyInfo, validates those entries, creates a TSIGKeyInfo instance @@ -751,7 +745,6 @@ public: /// @return pointer to the new TSIGKeyInfo instance TSIGKeyInfoPtr parse(data::ConstElementPtr key_config); -private: }; /// @brief Parser for a list of TSIGKeyInfos @@ -761,15 +754,9 @@ private: /// to the given storage upon commit. class TSIGKeyInfoListParser : public data::SimpleParser { public: - /// @brief Constructor - TSIGKeyInfoListParser(){}; - - /// @brief Destructor - virtual ~TSIGKeyInfoListParser(){}; - /// @brief Performs the parsing of the given list "tsig-key" elements. /// - /// Creates an emtpy TSIGKeyInfoMap + /// Creates an empty TSIGKeyInfoMap /// /// It iterates over each key entry in the list: /// 1. Instantiate a TSIGKeyInfoParser for the entry @@ -788,12 +775,6 @@ public: /// src/bin/d2/dhcp-ddns.spec and creates an instance of a DnsServerInfo. class DnsServerInfoParser : public data::SimpleParser { public: - /// @brief Constructor - DnsServerInfoParser(){}; - - /// @brief Destructor - virtual ~DnsServerInfoParser(){}; - /// @brief Performs the actual parsing of the given "dns-server" element. /// /// Parses a configuration for the elements needed to instantiate a @@ -818,12 +799,6 @@ public: /// to the given storage upon commit. class DnsServerInfoListParser : public data::SimpleParser{ public: - /// @brief Constructor - DnsServerInfoListParser(){}; - - /// @brief Destructor - virtual ~DnsServerInfoListParser(){}; - /// @brief Performs the actual parsing of the given list "dns-server" /// elements. /// @@ -844,12 +819,6 @@ public: /// src/bin/d2/dhcp-ddns.spec and creates an instance of a DdnsDomain. class DdnsDomainParser : public data::SimpleParser { public: - /// @brief Constructor - DdnsDomainParser(){}; - - /// @brief Destructor - virtual ~DdnsDomainParser(){}; - /// @brief Performs the actual parsing of the given "ddns-domain" element. /// /// Parses a configuration for the elements needed to instantiate a @@ -869,13 +838,6 @@ public: /// (see src/bin/d2/dhcp-ddns.spec) into a map of DdnsDomains. class DdnsDomainListParser : public data::SimpleParser { public: - - /// @brief Constructor - DdnsDomainListParser(){}; - - /// @brief Destructor - virtual ~DdnsDomainListParser(){}; - /// @brief Performs the actual parsing of the given list "ddns-domain" /// elements. /// Creates a new DdnsDomain map @@ -899,12 +861,6 @@ public: /// given DdnsDomainListMgr with parsed information. class DdnsDomainListMgrParser : public data::SimpleParser { public: - /// @brief Constructor - DdnsDomainListMgrParser(){}; - - /// @brief Destructor - virtual ~DdnsDomainListMgrParser(){}; - /// @brief Performs the actual parsing of the given manager element. /// /// Parses a configuration for the elements needed to instantiate a diff --git a/src/bin/d2/d2_controller.cc b/src/bin/d2/d2_controller.cc index 9e12c808d5..9b601223d2 100644 --- a/src/bin/d2/d2_controller.cc +++ b/src/bin/d2/d2_controller.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/src/bin/d2/d2_controller.h b/src/bin/d2/d2_controller.h index 4bb81ab7de..be00bde52f 100644 --- a/src/bin/d2/d2_controller.h +++ b/src/bin/d2/d2_controller.h @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -55,12 +55,13 @@ private: ///@brief Parse a given file into Elements /// - /// Uses bison parsing to parse a JSON configruation file into an + /// Uses bison parsing to parse a JSON configuration file into an /// a element map. /// /// @param file_name pathname of the file to parse /// /// @return pointer to the map of elements created + /// @throw BadValue if the file is empty virtual isc::data::ConstElementPtr parseFile(const std::string& file_name); /// @brief Constructor is declared private to maintain the integrity of diff --git a/src/bin/d2/d2_parser.yy b/src/bin/d2/d2_parser.yy index d5e85faee7..facfce7b26 100644 --- a/src/bin/d2/d2_parser.yy +++ b/src/bin/d2/d2_parser.yy @@ -248,20 +248,21 @@ sub_dhcpddns: LCURLY_BRACKET { }; dhcpddns_params: dhcpddns_param - | dhcpddns_params COMMA dhcpddns_param - ; -// These are teh top-level parameters allowed for DhcpDdns -dhcpddns_param: ip_address - | port - | dns_server_timeout - | ncr_protocol - | ncr_format - | forward_ddns - | reverse_ddns - | tsig_keys - | unknown_map_entry + | dhcpddns_params COMMA dhcpddns_param ; +// These are the top-level parameters allowed for DhcpDdns +dhcpddns_param: ip_address + | port + | dns_server_timeout + | ncr_protocol + | ncr_format + | forward_ddns + | reverse_ddns + | tsig_keys + | unknown_map_entry + ; + ip_address: IP_ADDRESS { ctx.enter(ctx.NO_KEYWORD); } COLON STRING { diff --git a/src/bin/d2/d2_simple_parser.cc b/src/bin/d2/d2_simple_parser.cc index 09ce3d27bd..69ae6ed0df 100644 --- a/src/bin/d2/d2_simple_parser.cc +++ b/src/bin/d2/d2_simple_parser.cc @@ -8,7 +8,6 @@ #include #include #include -#include using namespace isc::data; diff --git a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc index 921c56bcdf..b90e381efc 100644 --- a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc @@ -142,7 +142,7 @@ public: << "\njson: [" << json << " ]"; } - // JSON parsed ok, so the defaults to the element tree it produced. + // JSON parsed ok, so add the defaults to the element tree it produced. D2SimpleParser::setAllDefaults(elem); config_set_ = elem; } catch (const std::exception& ex) { @@ -150,7 +150,7 @@ public: if (exp_error.empty()) { // We did not expect an error, so fail. return ::testing::AssertionFailure() - << "Unexpected sytnax error:" << ex.what() + << "Unexpected syntax error:" << ex.what() << "\njson: [" << json << " ]"; } diff --git a/src/bin/d2/tests/d2_controller_unittests.cc b/src/bin/d2/tests/d2_controller_unittests.cc index 6795e71f29..4e5fcc4f03 100644 --- a/src/bin/d2/tests/d2_controller_unittests.cc +++ b/src/bin/d2/tests/d2_controller_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/src/bin/d2/tests/d2_process_unittests.cc b/src/bin/d2/tests/d2_process_unittests.cc index c6b1341156..8ab84bf240 100644 --- a/src/bin/d2/tests/d2_process_unittests.cc +++ b/src/bin/d2/tests/d2_process_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/src/bin/d2/tests/d2_simple_parser_unittest.cc b/src/bin/d2/tests/d2_simple_parser_unittest.cc index 25f34bc0dc..868147f440 100644 --- a/src/bin/d2/tests/d2_simple_parser_unittest.cc +++ b/src/bin/d2/tests/d2_simple_parser_unittest.cc @@ -97,7 +97,7 @@ bool checkKey(TSIGKeyInfoPtr key, const std::string& name, /// DnsServerInfo against the given set of values. /// /// It is structured in such a way that each value is checked, and output -/// is generate for all that do not match. +/// is generated for all that do not match. /// /// @param server is a pointer to the server to check against. /// @param hostname is the value to compare against server's hostname_. @@ -592,6 +592,7 @@ public: /// 2. Algorithm cannot be blank. /// 3. Secret cannot be blank. TEST_F(TSIGKeyInfoParserTest, invalidEntry) { + // Name cannot be blank. std::string config = "{" " \"name\": \"\" , " diff --git a/src/bin/d2/tests/parser_unittest.h b/src/bin/d2/tests/parser_unittest.h index 8db80ad173..15ef2a4d9d 100644 --- a/src/bin/d2/tests/parser_unittest.h +++ b/src/bin/d2/tests/parser_unittest.h @@ -10,7 +10,6 @@ #include #include #include -#include using namespace isc::data; using namespace std; diff --git a/src/bin/d2/tests/testdata/d2_cfg_tests.json b/src/bin/d2/tests/testdata/d2_cfg_tests.json index 9b65489a66..6250ba91a4 100644 --- a/src/bin/d2/tests/testdata/d2_cfg_tests.json +++ b/src/bin/d2/tests/testdata/d2_cfg_tests.json @@ -1,4 +1,4 @@ -# Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2014-2015,2017 Internet Systems Consortium, Inc. ("ISC") # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this