diff --git a/doc/guide/.gitignore b/doc/guide/.gitignore index 6719e462b2..388591cece 100644 --- a/doc/guide/.gitignore +++ b/doc/guide/.gitignore @@ -2,3 +2,5 @@ /kea-guide.txt /kea-messages.html /kea-messages.xml +/kea-guide.pdf +/kea-messages.pdf diff --git a/doc/guide/Makefile.am b/doc/guide/Makefile.am index ef751dc921..b969ca5b01 100644 --- a/doc/guide/Makefile.am +++ b/doc/guide/Makefile.am @@ -49,7 +49,7 @@ $(HTMLDOCS) $(DOCS): @echo Doc generation disabled. Creating dummy $@. Configure with --enable-generate-docs to enable it. @echo Doc generation disabled. Remove this file, configure with --enable-generate-docs, and rebuild Kea > $@ -endif +endif if HAVE_DBLATEX diff --git a/src/bin/admin/admin-utils.sh b/src/bin/admin/admin-utils.sh index 80f5410306..33616d9a90 100755 --- a/src/bin/admin/admin-utils.sh +++ b/src/bin/admin/admin-utils.sh @@ -18,12 +18,26 @@ mysql_execute() { QUERY=$1 shift - if [ $# -ge 1 ]; then - mysql -N -B $* -e "${QUERY}" + if [ $# -gt 1 ]; then + mysql -N -B "$@" -e "${QUERY}" retcode=$? else - mysql -N -B --host=$db_host --user=$db_user --password=$db_password -e "${QUERY}" $db_name - retcode="$?" + mysql -N -B --database="${db_name}" --user="${db_user}" --password="${db_password}" -e "${QUERY}" + retcode=$? + fi + + return $retcode +} + +mysql_execute_script() { + file=$1 + shift + if [ $# -ge 1 ]; then + mysql -N -B "$@" < "${file}" + retcode=$? + else + mysql -N -B --database="${db_name}" --user="${db_user}" --password="${db_password}" < "${file}" + retcode=$? fi return $retcode @@ -47,12 +61,12 @@ mysql_version() { pgsql_execute() { QUERY=$1 shift - if [ $# -ge 1 ]; then - echo $QUERY | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q $* + if [ $# -gt 0 ]; then + echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q "$@" retcode=$? else export PGPASSWORD=$db_password - echo $QUERY | psql --set ON_ERROR_STOP=1 -A -t -h $db_host -q -U $db_user -d $db_name + echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U "${db_user}" -d "${db_name}" retcode=$? fi return $retcode @@ -71,12 +85,12 @@ pgsql_execute() { pgsql_execute_script() { file=$1 shift - if [ $# -ge 1 ]; then - psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -f $file $* + if [ $# -gt 0 ]; then + psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -f "${file}" "$@" retcode=$? else export PGPASSWORD=$db_password - psql --set ON_ERROR_STOP=1 -A -t -h $db_host -q -U $db_user -d $db_name -f $file + psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U "${db_user}" -d "${db_name}" -f "${file}" retcode=$? fi return $retcode @@ -90,16 +104,16 @@ pgsql_version() { cql_execute() { query=$1 shift - if [ $# -ge 1 ]; then + if [ $# -gt 1 ]; then cqlsh "$@" -e "$query" retcode=$? else - cqlsh -u $db_user -p $db_password -k $db_name -e "$query" + cqlsh -u "${db_user}" -p "${db_password}" -k "${db_name}" -e "${query}" retcode=$? fi if [ $retcode -ne 0 ]; then - printf "cqlsh returned with exit status $retcode\n" + printf "cqlsh returned with exit status %s\n" "${retcode}" exit $retcode fi @@ -109,16 +123,16 @@ cql_execute() { cql_execute_script() { file=$1 shift - if [ $# -ge 1 ]; then - cqlsh "$@" -f "$file" + if [ $# -gt 1 ]; then + cqlsh "$@" -e "$file" retcode=$? else - cqlsh -u $db_user -p $db_password -k $db_name -f "$file" + cqlsh -u "${db_user}" -p "${db_password}" -k "${db_name}" -f "${file}" retcode=$? fi if [ $retcode -ne 0 ]; then - printf "cqlsh returned with exit status $retcode\n" + printf "cqlsh returned with exit status %s\n" "${retcode}" exit $retcode fi @@ -126,9 +140,8 @@ cql_execute_script() { } cql_version() { - version=$(cql_execute "SELECT version, minor FROM schema_version" "$@") - error=$? - version=$(echo "$version" | grep -A 1 "+" | grep -v "+" | tr -d ' ' | cut -d "|" -f 1-2 --output-delimiter=".") - echo "$version" - return $error + version=$(cql_execute "SELECT version, minor FROM schema_version" "$@") + version=$(echo "$version" | grep -A 1 "+" | grep -v "+" | tr -d ' ' | cut -d "|" -f 1-2 --output-delimiter=".") + echo "${version}" + return $? } diff --git a/src/bin/admin/kea-admin.xml b/src/bin/admin/kea-admin.xml index 1ecebe7801..edd15c865b 100644 --- a/src/bin/admin/kea-admin.xml +++ b/src/bin/admin/kea-admin.xml @@ -103,7 +103,6 @@ migrating between old and new Kea versions. - lease-dump @@ -114,6 +113,7 @@ The first line of file is a header line containing the column names. + diff --git a/src/bin/d2/tests/d2_update_message_unittests.cc b/src/bin/d2/tests/d2_update_message_unittests.cc index a17211a931..6e6fa5d949 100644 --- a/src/bin/d2/tests/d2_update_message_unittests.cc +++ b/src/bin/d2/tests/d2_update_message_unittests.cc @@ -25,21 +25,20 @@ using namespace isc::dns::rdata; using namespace isc::util; namespace { - -// @brief Test fixture class for testing D2UpdateMessage object. + /// @brief Test fixture class for testing D2UpdateMessage object class D2UpdateMessageTest : public ::testing::Test { public: - // @brief Constructor. + /// @brief Constructor // // Does nothing. D2UpdateMessageTest() { } - // @brief Destructor. + /// @brief Destructor // // Does nothing. ~D2UpdateMessageTest() { }; - // @brief Return string representation of the name encoded in wire format. + /// @brief Returns string representation of the name encoded in wire format. // // This function reads the number of bytes specified in the second // argument from the buffer. It doesn't check if buffer has sufficient diff --git a/src/bin/d2/tests/dns_client_unittests.cc b/src/bin/d2/tests/dns_client_unittests.cc index e370428867..74ddecc2df 100644 --- a/src/bin/d2/tests/dns_client_unittests.cc +++ b/src/bin/d2/tests/dns_client_unittests.cc @@ -36,8 +36,7 @@ const char* TEST_ADDRESS = "127.0.0.1"; const uint16_t TEST_PORT = 5301; const size_t MAX_SIZE = 1024; const long TEST_TIMEOUT = 5 * 1000; - -// @brief Test Fixture class. +/// @brief Test Fixture class // // This test fixture class implements DNSClient::Callback so as it can be // installed as a completion callback for tests it implements. This callback @@ -64,7 +63,7 @@ public: int received_; int expected_; - // @brief Constructor. + /// @brief Constructor // // This constructor overrides the default logging level of asiodns logger to // prevent it from emitting debug messages from IOFetch class. Such an error @@ -88,14 +87,14 @@ public: TEST_TIMEOUT); } - // @brief Destructor. + /// @brief Destructor // // Sets the asiodns logging level back to DEBUG. virtual ~DNSClientTest() { asiodns::logger.setSeverity(isc::log::DEBUG); }; - // @brief Exchange completion callback. + /// @brief Exchange completion callback // // This callback is called when the exchange with the DNS server is // complete or an error occurred. This includes the occurrence of a timeout. @@ -133,7 +132,7 @@ public: } } - // @brief Handler invoked when test timeout is hit. + /// @brief Handler invoked when test timeout is hit // // This callback stops all running (hanging) tasks on IO service. void testTimeoutHandler() { @@ -141,7 +140,7 @@ public: FAIL() << "Test timeout hit."; } - // @brief Handler invoked when test request is received. + /// @brief Handler invoked when test request is received // // This callback handler is installed when performing async read on a // socket to emulate reception of the DNS Update request by a server. @@ -180,7 +179,7 @@ public: *remote); } - // @brief Request handler for testing clients using TSIG + /// @brief Request handler for testing clients using TSIG // // This callback handler is installed when performing async read on a // socket to emulate reception of the DNS Update request with TSIG by a diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index 6557c97098..fef6ef62dc 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -176,6 +176,10 @@ a client's error or a server's purged database. % DHCP4_DHCP4O6_BAD_PACKET received malformed DHCPv4o6 packet: %1 A malformed DHCPv4o6 packet was received. +% DHCP4_DHCP4O6_PACKET_RECEIVED received DHCPv4o6 packet from DHCPv4 server (type %1) for %2 on interface %3 +This debug message is printed when the server is receiving a DHCPv4o6 +from the DHCPv4 server over inter-process communication. + % DHCP4_DHCP4O6_PACKET_SEND %1: trying to send packet %2 (type %3) to %4 on interface %5 encapsulating %6: %7 (type %8) The arguments specify the client identification information (HW address and client identifier), DHCPv6 message name and type, source IPv6 @@ -706,7 +710,3 @@ will drop its message if the received message was DHCPDISCOVER, and will send DHCPNAK if the received message was DHCPREQUEST. The argument includes the client and the transaction identification information. - -% DHCP6_DHCP4O6_PACKET_RECEIVED received DHCPv4o6 packet from DHCPv6 server (type %1) for %2 on interface %3 -This debug message is printed when the server is receiving a DHCPv4o6 -from the DHCPv6 server over inter-process communication. diff --git a/src/bin/dhcp4/dhcp4_srv.h b/src/bin/dhcp4/dhcp4_srv.h index f6b673cf0f..2bf8c1c7da 100644 --- a/src/bin/dhcp4/dhcp4_srv.h +++ b/src/bin/dhcp4/dhcp4_srv.h @@ -236,7 +236,7 @@ public: /// @brief returns Kea version on stdout and exit. /// redeclaration/redefinition. @ref Daemon::getVersion() static std::string getVersion(bool extended); - + /// @brief Main server processing loop. /// /// Main server processing loop. Call the processing step routine diff --git a/src/bin/dhcp4/dhcp4to6_ipc.cc b/src/bin/dhcp4/dhcp4to6_ipc.cc index e1222a1bb8..41f3a7f7fa 100644 --- a/src/bin/dhcp4/dhcp4to6_ipc.cc +++ b/src/bin/dhcp4/dhcp4to6_ipc.cc @@ -63,7 +63,7 @@ void Dhcp4to6Ipc::handler() { // from Dhcpv4Srv::run_one() after receivePacket() if (pkt) { - LOG_DEBUG(packet4_logger, DBG_DHCP4_BASIC, DHCP6_DHCP4O6_PACKET_RECEIVED) + LOG_DEBUG(packet4_logger, DBG_DHCP4_BASIC, DHCP4_DHCP4O6_PACKET_RECEIVED) .arg(static_cast(pkt->getType())) .arg(pkt->getRemoteAddr().toText()) .arg(pkt->getIface()); @@ -89,7 +89,7 @@ void Dhcp4to6Ipc::handler() { return; } - // Get the DHCPv4 message + // Get the DHCPv4 message. OptionPtr msg = msgs.begin()->second; if (!msg) { LOG_DEBUG(packet4_logger, DBG_DHCP4_DETAIL, DHCP4_DHCP4O6_BAD_PACKET) diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc b/src/bin/dhcp4/tests/get_config_unittest.cc index d06bd40017..be47e2599d 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc +++ b/src/bin/dhcp4/tests/get_config_unittest.cc @@ -6900,7 +6900,7 @@ outputFormatted(const std::string& config) { } } -}; +} // namespace namespace isc { namespace dhcp { @@ -6931,9 +6931,9 @@ extractConfig(const std::string& config) { ++extract_count; } -}; -}; -}; +} // namespace test +} // namespace dhcp +} // namespace isc namespace { @@ -7120,8 +7120,16 @@ TEST_P(Dhcp4GetConfigTest, run) { EXPECT_TRUE(isEquivalent(unparsed, unparsed2)); } -/// Define the parameterized test loop -INSTANTIATE_TEST_CASE_P(Dhcp4GetConfigTest, Dhcp4GetConfigTest, - ::testing::Range(static_cast(0), max_config_counter)); - +class IntToString { +public: + std::string operator()(const testing::TestParamInfo& n) { + return to_string(n.param); + } }; + +/// Define the parameterized test loop. +INSTANTIATE_TEST_CASE_P(Dhcp4GetConfigTest, Dhcp4GetConfigTest, + ::testing::Range(static_cast(0), + max_config_counter), + IntToString()); +} // namespace diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc.skel b/src/bin/dhcp4/tests/get_config_unittest.cc.skel index 97a1dae3b7..b295974557 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc.skel +++ b/src/bin/dhcp4/tests/get_config_unittest.cc.skel @@ -344,8 +344,16 @@ TEST_P(Dhcp4GetConfigTest, run) { EXPECT_TRUE(isEquivalent(unparsed, unparsed2)); } -/// Define the parameterized test loop -INSTANTIATE_TEST_CASE_P(Dhcp4GetConfigTest, Dhcp4GetConfigTest, - ::testing::Range(static_cast(0), max_config_counter)); - +class IntToString { +public: + std::string operator()(const testing::TestParamInfo& n) { + return to_string(n.param); + } }; + +/// Define the parameterized test loop. +INSTANTIATE_TEST_CASE_P(Dhcp4GetConfigTest, Dhcp4GetConfigTest, + ::testing::Range(static_cast(0), + max_config_counter), + IntToString()); +} // namespace diff --git a/src/bin/dhcp6/dhcp6_messages.mes b/src/bin/dhcp6/dhcp6_messages.mes index 8adb5e9dd6..d69bf81398 100644 --- a/src/bin/dhcp6/dhcp6_messages.mes +++ b/src/bin/dhcp6/dhcp6_messages.mes @@ -763,7 +763,7 @@ processing will continue, but the response will only contain generic configuration and no addresses or prefixes. The argument includes the client and the transaction identification information. -% DHCP6_UNKNOWN_MSG_RECEIVED received unknown message (type %d) on interface %2 +% DHCP6_UNKNOWN_MSG_RECEIVED received unknown message (type %1) on interface %2 This debug message is printed when server receives a message of unknown type. That could either mean missing functionality or invalid or broken relay or client. The list of formally defined message types is available here: diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc b/src/bin/dhcp6/tests/get_config_unittest.cc index 1759c8373b..36a54a330b 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc +++ b/src/bin/dhcp6/tests/get_config_unittest.cc @@ -6459,7 +6459,7 @@ outputFormatted(const std::string& config) { } } -}; +} namespace isc { namespace dhcp { @@ -6490,9 +6490,9 @@ extractConfig(const std::string& config) { ++extract_count; } -}; -}; -}; +} // namespace test +} // namespace dhcp +} // namespace isc namespace { @@ -6682,8 +6682,16 @@ TEST_P(Dhcp6GetConfigTest, run) { EXPECT_TRUE(isEquivalent(unparsed, unparsed2)); } -/// Define the parameterized test loop -INSTANTIATE_TEST_CASE_P(Dhcp6GetConfigTest, Dhcp6GetConfigTest, - ::testing::Range(static_cast(0), max_config_counter)); - +class IntToString { +public: + std::string operator()(const testing::TestParamInfo& n) { + return to_string(n.param); + } }; + +/// Define the parameterized test loop. +INSTANTIATE_TEST_CASE_P(Dhcp6GetConfigTest, Dhcp6GetConfigTest, + ::testing::Range(static_cast(0), + max_config_counter), + IntToString()); +} // namespace diff --git a/src/bin/dhcp6/tests/get_config_unittest.cc.skel b/src/bin/dhcp6/tests/get_config_unittest.cc.skel index e17b6288c8..bd08eae7ce 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc.skel +++ b/src/bin/dhcp6/tests/get_config_unittest.cc.skel @@ -348,8 +348,16 @@ TEST_P(Dhcp6GetConfigTest, run) { EXPECT_TRUE(isEquivalent(unparsed, unparsed2)); } -/// Define the parameterized test loop -INSTANTIATE_TEST_CASE_P(Dhcp6GetConfigTest, Dhcp6GetConfigTest, - ::testing::Range(static_cast(0), max_config_counter)); - +class IntToString { +public: + std::string operator()(const testing::TestParamInfo& n) { + return to_string(n.param); + } }; + +/// Define the parameterized test loop. +INSTANTIATE_TEST_CASE_P(Dhcp6GetConfigTest, Dhcp6GetConfigTest, + ::testing::Range(static_cast(0), + max_config_counter), + IntToString()); +} // namespace diff --git a/src/bin/perfdhcp/.gitignore b/src/bin/perfdhcp/.gitignore index 2b5ab596d9..bdb5d378bb 100644 --- a/src/bin/perfdhcp/.gitignore +++ b/src/bin/perfdhcp/.gitignore @@ -1,2 +1,3 @@ /perfdhcp +/perfdhcp.1 /perfdhcp.8 diff --git a/src/lib/asiolink/io_address.h b/src/lib/asiolink/io_address.h index f6cbc07d65..42f09d7a9f 100644 --- a/src/lib/asiolink/io_address.h +++ b/src/lib/asiolink/io_address.h @@ -145,7 +145,7 @@ public: /// \brief Creates an address from over wire data. /// - /// \param family AF_NET for IPv4 or AF_NET6 for IPv6. + /// \param family AF_INET for IPv4 or AF_INET6 for IPv6. /// \param data pointer to first char of data /// /// \return Created IOAddress object diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc index 07bdcc816a..704075cbd9 100644 --- a/src/lib/cc/data.cc +++ b/src/lib/cc/data.cc @@ -1235,7 +1235,7 @@ prettyPrint(ConstElementPtr element, std::ostream& out, // open the list out << "[" << (complex ? "\n" : " "); - + // iterate on items typedef std::vector ListType; const ListType& l = element->listValue(); diff --git a/src/lib/cryptolink/tests/run_unittests.cc b/src/lib/cryptolink/tests/run_unittests.cc index 9f3b06f39c..b2e8e4fccc 100644 --- a/src/lib/cryptolink/tests/run_unittests.cc +++ b/src/lib/cryptolink/tests/run_unittests.cc @@ -5,12 +5,11 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include +#include #include #include -#include - int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); diff --git a/src/lib/dhcp/option6_pdexclude.cc b/src/lib/dhcp/option6_pdexclude.cc index d8b78d4a20..951b3f117f 100644 --- a/src/lib/dhcp/option6_pdexclude.cc +++ b/src/lib/dhcp/option6_pdexclude.cc @@ -7,7 +7,6 @@ #include #include -#include #include #include #include diff --git a/src/lib/dhcp/option_definition.cc b/src/lib/dhcp/option_definition.cc index 222d158cdb..8f07b97119 100644 --- a/src/lib/dhcp/option_definition.cc +++ b/src/lib/dhcp/option_definition.cc @@ -5,6 +5,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include + #include #include #include @@ -39,7 +40,6 @@ using namespace isc::util; namespace isc { namespace dhcp { - OptionDefinition::OptionDefinition(const std::string& name, const uint16_t code, const std::string& type, @@ -655,7 +655,6 @@ OptionDefinition::writeToBuffer(Option::Universe u, << " is not valid."); } - // Write a prefix. OptionDataTypeUtil::writePrefix(PrefixLen(len), address, buf); diff --git a/src/lib/dhcp/tests/option_definition_unittest.cc b/src/lib/dhcp/tests/option_definition_unittest.cc index a7ba90541e..9854af2402 100644 --- a/src/lib/dhcp/tests/option_definition_unittest.cc +++ b/src/lib/dhcp/tests/option_definition_unittest.cc @@ -38,7 +38,7 @@ namespace { /// it around for the future. class OptionDefinitionTest : public ::testing::Test { public: - // @brief Constructor. + /// @brief Constructor OptionDefinitionTest() { } }; @@ -1611,7 +1611,7 @@ TEST_F(OptionDefinitionTest, tuple4Tokenized) { OpaqueDataTuple tuple(OpaqueDataTuple::LENGTH_1_BYTE); ASSERT_NO_THROW(option_cast->readTuple(tuple)); EXPECT_EQ("foobar", tuple.getText()); -} +} // This test verifies that a definition of an option with a single DHCPv6 // tuple can be created and that the instance of this option can be @@ -1640,7 +1640,7 @@ TEST_F(OptionDefinitionTest, tuple6Tokenized) { OpaqueDataTuple tuple(OpaqueDataTuple::LENGTH_2_BYTES); ASSERT_NO_THROW(option_cast->readTuple(tuple)); EXPECT_EQ("foobar", tuple.getText()); -} +} // This test verifies that a definition of an option with an array // of DHCPv4 tuples can be created and that the instance of this option diff --git a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc index b517a6b469..7d492cbfc6 100644 --- a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc +++ b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc @@ -217,9 +217,10 @@ public: result_ = result; received_ncr_ = ncr; } - // @brief Handler invoked when test timeout is hit. - // - // This callback stops all running (hanging) tasks on IO service. + + /// @brief Handler invoked when test timeout is hit + /// + /// This callback stops all running (hanging) tasks on IO service. void testTimeoutHandler() { io_service_.stop(); FAIL() << "Test timeout hit."; @@ -656,9 +657,9 @@ public: sent_ncrs_.push_back(ncr); } - // @brief Handler invoked when test timeout is hit. - // - // This callback stops all running (hanging) tasks on IO service. + /// @brief Handler invoked when test timeout is hit + /// + /// This callback stops all running (hanging) tasks on IO service. void testTimeoutHandler() { io_service_.stop(); FAIL() << "Test timeout hit."; diff --git a/src/lib/dhcpsrv/alloc_engine.h b/src/lib/dhcpsrv/alloc_engine.h index 382a30f520..7c3ee98822 100644 --- a/src/lib/dhcpsrv/alloc_engine.h +++ b/src/lib/dhcpsrv/alloc_engine.h @@ -1534,7 +1534,6 @@ private: /// @brief Number of consecutive DHCPv6 leases' reclamations after /// which there are still expired leases in the database. uint16_t incomplete_v6_reclamations_; - }; /// @brief A pointer to the @c AllocEngine object. diff --git a/src/lib/dhcpsrv/cfg_option.cc b/src/lib/dhcpsrv/cfg_option.cc index 1b327fd14d..45da5b275b 100644 --- a/src/lib/dhcpsrv/cfg_option.cc +++ b/src/lib/dhcpsrv/cfg_option.cc @@ -7,9 +7,9 @@ #include #include -#include #include #include +#include #include #include #include @@ -285,5 +285,5 @@ CfgOption::toElement() const { return (result); } -} // end of namespace isc::dhcp -} // end of namespace isc +} // namespace dhcp +} // namespace isc diff --git a/src/lib/dhcpsrv/cql_host_data_source.cc b/src/lib/dhcpsrv/cql_host_data_source.cc index 13c1a594cc..7e2416cceb 100644 --- a/src/lib/dhcpsrv/cql_host_data_source.cc +++ b/src/lib/dhcpsrv/cql_host_data_source.cc @@ -1607,6 +1607,7 @@ CqlHostDataSourceImpl::getAll(const HWAddrPtr& hwaddr, const DuidPtr& duid) cons // Run statement. ConstHostCollection result = getHostCollection(CqlHostExchange::GET_HOST_BY_HOST_ID, where_values); + return (result); } @@ -1642,6 +1643,7 @@ CqlHostDataSourceImpl::getAll4(const asiolink::IOAddress& address) const { // Run statement. ConstHostCollection result = getHostCollection(CqlHostExchange::GET_HOST_BY_IPV4_ADDRESS, where_values); + return (result); } diff --git a/src/lib/dhcpsrv/cql_lease_mgr.cc b/src/lib/dhcpsrv/cql_lease_mgr.cc index 5036044b75..8f3c351b7f 100644 --- a/src/lib/dhcpsrv/cql_lease_mgr.cc +++ b/src/lib/dhcpsrv/cql_lease_mgr.cc @@ -58,8 +58,7 @@ public: /// @param statement_tag prepared statement being executed; defaults to an /// invalid index virtual void - createBindForSelect(AnyArray &data, - StatementTag statement_tag = NULL) override = 0; + createBindForSelect(AnyArray &data, StatementTag statement_tag = NULL) override = 0; /// @brief Copy received data into the derived class' object. /// @@ -115,8 +114,9 @@ class CqlLease4Exchange : public CqlLeaseExchange { public: /// @brief Constructor /// - /// The initialization of the variables here is only to satisfy cppcheck - - /// all variables are initialized/set in the methods before they are used. + /// The initialization of the variables here is only to satisfy + /// cppcheck - all variables are initialized/set in the methods before + /// they are used. /// /// @param connection connection used for this query explicit CqlLease4Exchange(const CqlConnection &connection); @@ -138,8 +138,7 @@ public: /// @param lease Updated lease information. /// @param data lease info in CQL format will be stored here /// @param statement_tag tag identifying the query (optional) - void createBindForUpdate(const Lease4Ptr &lease, - AnyArray &data, + void createBindForUpdate(const Lease4Ptr &lease, AnyArray &data, StatementTag statement_tag = NULL); /// @brief Create CQL_BIND objects for Lease4 Pointer @@ -329,7 +328,7 @@ StatementMap CqlLease4Exchange::tagged_statements_{ // Gets an IPv4 lease with specified hardware addr and subnet-id {GET_LEASE4_HWADDR_SUBID, - {GET_LEASE4_HWADDR_SUBID, + {GET_LEASE4_HWADDR_SUBID, "SELECT " "address, hwaddr, client_id, valid_lifetime, expire, subnet_id, " "fqdn_fwd, fqdn_rev, hostname, state " @@ -431,10 +430,9 @@ CqlLease4Exchange::createBindForInsert(const Lease4Ptr &lease, AnyArray &data) { data.add(&state_); } catch (const Exception &ex) { - isc_throw(DbOperationError, - "CqlLease4Exchange::createBindForInsert(): " - "could not create bind array from Lease4: " - << lease_->addr_.toText() << ", reason: " << ex.what()); + isc_throw(DbOperationError, "CqlLease4Exchange::createBindForInsert(): " + "could not create bind array from Lease4: " << lease_->addr_.toText() + << ", reason: " << ex.what()); } } @@ -541,8 +539,6 @@ CqlLease4Exchange::createBindForDelete(const IOAddress &address, AnyArray &data, try { // address: int - // The address in the Lease structure is an IOAddress object. - // Convert this to an integer for storage. address_ = static_cast(address.toUint32()); // Start with a fresh array. @@ -552,8 +548,8 @@ CqlLease4Exchange::createBindForDelete(const IOAddress &address, AnyArray &data, } catch (const Exception &ex) { isc_throw(DbOperationError, "CqlLease4Exchange::createBindForDelete(): " - "could not create bind array from Lease4: " - << lease_->addr_.toText() << ", reason: " << ex.what()); + "could not create bind array with address: " + << address_ << ", reason: " << ex.what()); } } @@ -639,7 +635,7 @@ CqlLease4Exchange::retrieve() { return (result); } catch (const Exception &ex) { isc_throw(DbOperationError, - "CqlLease4Exchange::retrieveLease(): " + "CqlLease4Exchange::retrieve(): " "could not convert data to Lease4, reason: " << ex.what()); } @@ -732,7 +728,7 @@ class CqlLease6Exchange : public CqlLeaseExchange { public: /// @brief Constructor /// - /// The initialization of the variables here is nonly to satisfy + /// The initialization of the variables here is only to satisfy /// cppcheck - all variables are initialized/set in the methods before /// they are used. /// @@ -741,7 +737,7 @@ public: /// @brief Create CQL_BIND objects for Lease6 Pointer /// - /// Fills in the CQL_BIND array for sending data in the Lease4 object to + /// Fills in the CQL_BIND array for sending data in the Lease6 object to /// the database. Used for INSERT statements. /// /// @param lease The lease information to be inserted @@ -750,7 +746,7 @@ public: /// @brief Create CQL_BIND objects for Lease6 Pointer /// - /// Fills in the CQL_BIND array for sending data in the Lease4 object to + /// Fills in the CQL_BIND array for sending data in the Lease6 object to /// the database. Used for UPDATE statements. /// /// @param lease Updated lease information. @@ -761,13 +757,14 @@ public: /// @brief Create CQL_BIND objects for Lease4 Pointer /// - /// Fills in the CQL_BIND array for sending data in the Lease4 object to + /// Fills in the CQL_BIND array for sending data in the Lease6 object to /// the database. Used for DELETE statements. /// /// @param address address of the lease to be deleted /// @param data lease info in CQL format will be stored here /// @param statement_tag tag identifying the query (optional) - void createBindForDelete(const IOAddress &address, AnyArray &data, + void createBindForDelete(const IOAddress &address, + AnyArray &data, StatementTag statement_tag = NULL); /// @brief Create BIND array to receive data @@ -776,13 +773,13 @@ public: /// /// @param data info returned by CQL will be stored here /// @param statement_tag tag identifying the query (optional) - void createBindForSelect(AnyArray &data, - StatementTag statement_tag = NULL) override; + virtual void + createBindForSelect(AnyArray &data, StatementTag statement_tag = NULL) override; /// @brief Retrieves the Lease6 object in Kea format /// /// @return C++ representation of the object being returned - boost::any retrieve() override; + virtual boost::any retrieve() override; /// @brief Retrieves zero or more IPv6 leases /// @@ -963,7 +960,8 @@ CqlLease6Exchange::CqlLease6Exchange(const CqlConnection &connection) void CqlLease6Exchange::createBindForInsert(const Lease6Ptr &lease, AnyArray &data) { if (!lease) { - isc_throw(BadValue, "Lease6 object is NULL"); + isc_throw(BadValue, "CqlLease6Exchange::createBindForInsert(): " + "Lease6 object is NULL"); } // Store lease object to ensure it remains valid. lease_ = lease; @@ -1087,7 +1085,8 @@ void CqlLease6Exchange::createBindForUpdate(const Lease6Ptr &lease, AnyArray &data, StatementTag /* unused */) { if (!lease) { - isc_throw(BadValue, "Lease6 object is NULL"); + isc_throw(BadValue, "CqlLease6Exchange::createBindForUpdate(): " + "Lease6 object is NULL"); } // Store lease object to ensure it remains valid. lease_ = lease; @@ -1225,8 +1224,6 @@ CqlLease6Exchange::createBindForDelete(const IOAddress &address, AnyArray &data, // structure. try { // address: varchar - // The address in the Lease structure is an IOAddress object. - // Convert this to an integer for storage. address_ = address.toText(); // Start with a fresh array. @@ -1356,11 +1353,12 @@ CqlLease6Exchange::retrieve() { result->cltt_ = cltt; result->state_ = state_; - return result; + + return (result); } catch (const Exception &ex) { isc_throw(DbOperationError, "CqlLease6Exchange::retrieve(): " - "could not convert data to Lease4, reason: " + "could not convert data to Lease6, reason: " << ex.what()); } return Lease6Ptr(); @@ -1391,11 +1389,10 @@ CqlLease6Exchange::getLease(StatementTag &statement_tag, AnyArray &data, // Return single record if present, else clear the lease. const size_t collection_size = collection.size(); if (collection_size >= 2u) { - isc_throw( - MultipleRecords, - "CqlLease6Exchange::getLease(): multiple records were found in " - "the database where only one was expected for statement " - << statement_tag); + isc_throw(MultipleRecords, + "CqlLease6Exchange::getLease(): multiple records were found in " + "the database where only one was expected for statement " + << statement_tag); } else if (collection_size == 0u) { result.reset(); } else { @@ -1467,8 +1464,7 @@ CqlLeaseMgr::addLease(const Lease4Ptr &lease) { AnyArray data; - std::unique_ptr exchange4( - new CqlLease4Exchange(dbconn_)); + std::unique_ptr exchange4(new CqlLease4Exchange(dbconn_)); exchange4->createBindForInsert(lease, data); try { exchange4->executeMutation(dbconn_, data, CqlLease4Exchange::INSERT_LEASE4); @@ -1578,7 +1574,7 @@ CqlLeaseMgr::getLease4(const ClientId &clientid) const { std::unique_ptr exchange4(new CqlLease4Exchange(dbconn_)); exchange4->getLeaseCollection(CqlLease4Exchange::GET_LEASE4_CLIENTID, data, result); - return result; + return (result); } Lease4Ptr @@ -1684,7 +1680,7 @@ CqlLeaseMgr::getLeases6(Lease::Type lease_type, const DUID &duid, uint32_t iaid) std::unique_ptr exchange6(new CqlLease6Exchange(dbconn_)); exchange6->getLeaseCollection(CqlLease6Exchange::GET_LEASE6_DUID_IAID, data, result); - return result; + return (result); } Lease6Collection @@ -1715,6 +1711,7 @@ CqlLeaseMgr::getLeases6(Lease::Type lease_type, const DUID &duid, uint32_t iaid, Lease6Collection result; std::unique_ptr exchange6(new CqlLease6Exchange(dbconn_)); exchange6->getLeaseCollection(CqlLease6Exchange::GET_LEASE6_DUID_IAID_SUBID, data, result); + return (result); } @@ -1734,8 +1731,7 @@ CqlLeaseMgr::getExpiredLeases6(Lease6Collection &expired_leases, LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_CQL_GET_EXPIRED6) .arg(max_leases); - std::unique_ptr exchange6( - new CqlLease6Exchange(dbconn_)); + std::unique_ptr exchange6(new CqlLease6Exchange(dbconn_)); exchange6->getExpiredLeases(max_leases, expired_leases); } diff --git a/src/lib/dhcpsrv/dhcp4o6_ipc.cc b/src/lib/dhcpsrv/dhcp4o6_ipc.cc index 86dfafc378..ac58fd11a5 100644 --- a/src/lib/dhcpsrv/dhcp4o6_ipc.cc +++ b/src/lib/dhcpsrv/dhcp4o6_ipc.cc @@ -151,7 +151,7 @@ Pkt6Ptr Dhcp4o6IpcBase::receive() { option_vendor.reset(); } } - + // Vendor option must exist. if (!option_vendor) { LOG_WARN(dhcpsrv_logger, DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET) diff --git a/src/lib/dhcpsrv/mysql_host_data_source.h b/src/lib/dhcpsrv/mysql_host_data_source.h index 12a2a06c4c..3850d8cd3c 100644 --- a/src/lib/dhcpsrv/mysql_host_data_source.h +++ b/src/lib/dhcpsrv/mysql_host_data_source.h @@ -11,6 +11,11 @@ #include #include +#include + +#include +#include + namespace isc { namespace dhcp { @@ -306,7 +311,6 @@ public: virtual void rollback(); private: - /// @brief Pointer to the implementation of the @ref MySqlHostDataSource. MySqlHostDataSourceImpl* impl_; }; @@ -315,3 +319,4 @@ private: } #endif // MYSQL_HOST_DATA_SOURCE_H + diff --git a/src/lib/dhcpsrv/pgsql_connection.h b/src/lib/dhcpsrv/pgsql_connection.h index 4b1bd4f22c..9b2f01a627 100644 --- a/src/lib/dhcpsrv/pgsql_connection.h +++ b/src/lib/dhcpsrv/pgsql_connection.h @@ -27,7 +27,7 @@ const uint32_t PG_SCHEMA_VERSION_MINOR = 0; // statement. const size_t PGSQL_MAX_PARAMETERS_IN_QUERY = 32; -/// @brief Define a PostgreSQL SQL statement +/// @brief Define a PostgreSQL statement. /// /// Each statement is associated with an index, which is used to reference the /// associated prepared statement. @@ -49,6 +49,7 @@ struct PgSqlTaggedStatement { const char* text; }; +/// @{ /// @brief Constants for PostgreSQL data types /// These are defined by PostgreSQL in , but including /// this file is extraordinarily convoluted, so we'll use these to fill-in. @@ -62,7 +63,7 @@ const size_t OID_INT4 = 23; // 4 byte int const size_t OID_TEXT = 25; const size_t OID_VARCHAR = 1043; const size_t OID_TIMESTAMP = 1114; -///@} +/// @} /// @brief RAII wrapper for PostgreSQL Result sets /// @@ -293,7 +294,7 @@ private: /// that use instances of PgSqlConnection. class PgSqlConnection : public DatabaseConnection { public: - /// @brief Define the PgSql error state for a duplicate key error + /// @brief Define the PgSql error state for a duplicate key error. static const char DUPLICATE_KEY[]; /// @brief Constructor diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h index 07b7948cc3..29694760bf 100644 --- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h +++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h @@ -165,10 +165,10 @@ public: /// @brief Test lease retrieval using client id, HW address and subnet id. void testGetLease4ClientIdHWAddrSubnetId(); - // @brief Get lease4 by hardware address (2) - // - // Check that the system can cope with getting a hardware address of - // any size. + /// @brief Get lease4 by hardware address (2) + /// + /// Check that the system can cope with getting a hardware address of + /// any size. void testGetLease4HWAddrSize(); /// @brief Check GetLease4 methods - access by Hardware Address & Subnet ID diff --git a/src/lib/eval/eval_context.h b/src/lib/eval/eval_context.h index e2eb816bc5..96c683604c 100644 --- a/src/lib/eval/eval_context.h +++ b/src/lib/eval/eval_context.h @@ -169,7 +169,7 @@ public: return (option_universe_); } - private: +private: /// @brief Flag determining scanner debugging. bool trace_scanning_; diff --git a/src/lib/process/testutils/d_test_stubs.h b/src/lib/process/testutils/d_test_stubs.h index c30695eaea..0c76a4a1d8 100644 --- a/src/lib/process/testutils/d_test_stubs.h +++ b/src/lib/process/testutils/d_test_stubs.h @@ -154,7 +154,7 @@ public: return (""); } - // @brief Destructor + /// @brief Destructor virtual ~DStubProcess(); }; diff --git a/src/lib/stats/stats_mgr.h b/src/lib/stats/stats_mgr.h index fe641372a1..554e309e91 100644 --- a/src/lib/stats/stats_mgr.h +++ b/src/lib/stats/stats_mgr.h @@ -327,7 +327,7 @@ class StatsMgr : public boost::noncopyable { /// @} - private: +private: /// @brief Private constructor. /// StatsMgr is a singleton. It should be accessed using @ref instance diff --git a/src/lib/util/threads/tests/condvar_unittest.cc b/src/lib/util/threads/tests/condvar_unittest.cc index 2921713365..80b2472743 100644 --- a/src/lib/util/threads/tests/condvar_unittest.cc +++ b/src/lib/util/threads/tests/condvar_unittest.cc @@ -134,15 +134,13 @@ signalAndWait(CondVar* condvar, Mutex* mutex) { condvar->wait(*mutex); } -TEST_F(CondVarTest, #ifdef HAS_UNDEFINED_PTHREAD_BEHAVIOR - DISABLED_destroyWhileWait +TEST_F(CondVarTest, DISABLED_destroyWhileWait) { #else // This tests had to be disabled because it hangs on most of the OS used in lab // TODO fix destroyWhileWait test - DISABLED_destroyWhileWait +TEST_F(CondVarTest, DISABLED_destroyWhileWait) { #endif -) { // We'll destroy a CondVar object while the thread is still waiting // on it. This will trigger an assertion failure. if (!isc::util::unittests::runningOnValgrind()) { diff --git a/src/lib/util/threads/tests/lock_unittest.cc b/src/lib/util/threads/tests/lock_unittest.cc index 7969798750..0ed9be0c13 100644 --- a/src/lib/util/threads/tests/lock_unittest.cc +++ b/src/lib/util/threads/tests/lock_unittest.cc @@ -79,13 +79,11 @@ TEST(MutexTest, lockNonBlocking) { #endif // ENABLE_DEBUG // Destroying a locked mutex is a bad idea as well -TEST(MutexTest, #ifdef HAS_UNDEFINED_PTHREAD_BEHAVIOR - DISABLED_destroyLocked +TEST(MutexTest, DISABLED_destroyLocked) { #else - destroyLocked +TEST(MutexTest, destroyLocked) { #endif -) { if (!isc::util::unittests::runningOnValgrind()) { EXPECT_DEATH_IF_SUPPORTED({ Mutex* mutex = new Mutex;