From bfbf2b700bbe1d25e3be0d6110594edee5fd6795 Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Wed, 14 Dec 2016 16:47:41 +0200 Subject: [PATCH 01/11] [WIP] Minor changes --- .gitignore | 1 + doc/guide/.gitignore | 2 ++ src/bin/admin/kea-admin.xml | 2 +- src/bin/perfdhcp/.gitignore | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4594d7c40c..01711bbe70 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.la *.lo *.o +*.dirstamp .deps/ .libs/ __pycache__/ 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/src/bin/admin/kea-admin.xml b/src/bin/admin/kea-admin.xml index 7ef4788f96..7608988922 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/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 From 25b65b4403d760eaa8aa084f3b2973a79a5bb2b8 Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Fri, 23 Dec 2016 16:47:05 +0200 Subject: [PATCH 02/11] Brought bash code to Google coding standard --- src/bin/admin/admin-utils.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/bin/admin/admin-utils.sh b/src/bin/admin/admin-utils.sh index 3df7d4fc4e..5c8be36f9b 100755 --- a/src/bin/admin/admin-utils.sh +++ b/src/bin/admin/admin-utils.sh @@ -19,10 +19,10 @@ mysql_execute() { QUERY=$1 shift if [ $# -gt 1 ]; then - mysql -N -B $* -e "${QUERY}" + mysql -N -B "$@" -e "${QUERY}" retcode=$? else - mysql -N -B --user=$db_user --password=$db_password -e "${QUERY}" $db_name + mysql -N -B --database=${db_name} --user=${db_user} --password=${db_password} -e "${QUERY}" retcode="$?" fi @@ -48,11 +48,11 @@ pgsql_execute() { QUERY=$1 shift if [ $# -gt 0 ]; then - echo $QUERY | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q $* + 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 localhost -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 @@ -72,11 +72,11 @@ pgsql_execute_script() { file=$1 shift if [ $# -gt 0 ]; then - psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -f $file $* + 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 localhost -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 @@ -91,15 +91,15 @@ cql_execute() { query=$1 shift if [ $# -gt 1 ]; then - cqlsh $* -e "$query" + 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 @@ -110,15 +110,15 @@ cql_execute_script() { file=$1 shift if [ $# -gt 1 ]; then - cqlsh $* -e "$file" + 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,8 +126,8 @@ cql_execute_script() { } cql_version() { - 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 + 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 $? } From 0c0383ae4881368602770494b12aa006ed98e164 Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Fri, 23 Dec 2016 18:54:45 +0200 Subject: [PATCH 03/11] Removed "--nonet" from all xsltproc commands. --nonet prevented XSL files from being downloaded and thus prevented make commands from terminating succesfully. Supposedly, on some machines --nonet works and is faster. --- doc/guide/Makefile.am | 4 ++-- src/bin/admin/Makefile.am | 2 +- src/bin/d2/Makefile.am | 2 +- src/bin/dhcp4/Makefile.am | 2 +- src/bin/dhcp6/Makefile.am | 2 +- src/bin/keactrl/Makefile.am | 2 +- src/bin/lfc/Makefile.am | 2 +- src/bin/perfdhcp/Makefile.am | 2 +- src/bin/sockcreator/Makefile.am | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/guide/Makefile.am b/doc/guide/Makefile.am index 561c142893..db750fe52e 100644 --- a/doc/guide/Makefile.am +++ b/doc/guide/Makefile.am @@ -22,7 +22,7 @@ kea-messages.xml: if GENERATE_DOCS kea-guide.html: $(DOCBOOK) - @XSLTPROC@ --novalid --xinclude --nonet \ + @XSLTPROC@ --novalid --xinclude \ --path $(top_builddir)/doc \ -o $@ \ --stringparam section.autolabel 1 \ @@ -35,7 +35,7 @@ kea-guide.txt: kea-guide.html @ELINKS@ -dump -no-numbering -no-references kea-guide.html > $@ kea-messages.html: kea-messages.xml - @XSLTPROC@ --novalid --xinclude --nonet \ + @XSLTPROC@ --novalid --xinclude \ --path $(top_builddir)/doc \ -o $@ \ --stringparam generate.toc "book toc" \ diff --git a/src/bin/admin/Makefile.am b/src/bin/admin/Makefile.am index a71ee1c737..775e4cee2f 100644 --- a/src/bin/admin/Makefile.am +++ b/src/bin/admin/Makefile.am @@ -10,7 +10,7 @@ EXTRA_DIST = $(man_MANS) kea-admin.xml admin-utils.sh if GENERATE_DOCS kea-admin.8: kea-admin.xml - @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/kea-admin.xml + @XSLTPROC@ --novalid --xinclude -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/kea-admin.xml else diff --git a/src/bin/d2/Makefile.am b/src/bin/d2/Makefile.am index 895865e4da..bc6627ce20 100644 --- a/src/bin/d2/Makefile.am +++ b/src/bin/d2/Makefile.am @@ -35,7 +35,7 @@ EXTRA_DIST += images/trans_classes.svg images/update_exec_classes.svg if GENERATE_DOCS kea-dhcp-ddns.8: kea-dhcp-ddns.xml - @XSLTPROC@ --novalid --xinclude --nonet -o $@ \ + @XSLTPROC@ --novalid --xinclude -o $@ \ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \ $(srcdir)/kea-dhcp-ddns.xml diff --git a/src/bin/dhcp4/Makefile.am b/src/bin/dhcp4/Makefile.am index 8360677861..4a6ec7ccc1 100644 --- a/src/bin/dhcp4/Makefile.am +++ b/src/bin/dhcp4/Makefile.am @@ -29,7 +29,7 @@ EXTRA_DIST += dhcp4.dox dhcp4_hooks.dox dhcp4o6.dox if GENERATE_DOCS kea-dhcp4.8: kea-dhcp4.xml - @XSLTPROC@ --novalid --xinclude --nonet -o $@ \ + @XSLTPROC@ --novalid --xinclude -o $@ \ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \ $(srcdir)/kea-dhcp4.xml diff --git a/src/bin/dhcp6/Makefile.am b/src/bin/dhcp6/Makefile.am index 7653582e65..b307b246a7 100644 --- a/src/bin/dhcp6/Makefile.am +++ b/src/bin/dhcp6/Makefile.am @@ -30,7 +30,7 @@ EXTRA_DIST += dhcp6.dox dhcp6_hooks.dox dhcp4o6.dox if GENERATE_DOCS kea-dhcp6.8: kea-dhcp6.xml - @XSLTPROC@ --novalid --xinclude --nonet -o $@ \ + @XSLTPROC@ --novalid --xinclude -o $@ \ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \ $(srcdir)/kea-dhcp6.xml diff --git a/src/bin/keactrl/Makefile.am b/src/bin/keactrl/Makefile.am index c83a597457..223a6e1939 100644 --- a/src/bin/keactrl/Makefile.am +++ b/src/bin/keactrl/Makefile.am @@ -19,7 +19,7 @@ BUILT_SOURCES = kea.conf if GENERATE_DOCS keactrl.8: keactrl.xml - @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/keactrl.xml + @XSLTPROC@ --novalid --xinclude -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/keactrl.xml else diff --git a/src/bin/lfc/Makefile.am b/src/bin/lfc/Makefile.am index 7bfeb96df7..91dee0672b 100644 --- a/src/bin/lfc/Makefile.am +++ b/src/bin/lfc/Makefile.am @@ -17,7 +17,7 @@ EXTRA_DIST = $(man_MANS) kea-lfc.xml lfc.dox if GENERATE_DOCS kea-lfc.8: kea-lfc.xml - @XSLTPROC@ --novalid --xinclude --nonet -o $@ \ + @XSLTPROC@ --novalid --xinclude -o $@ \ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \ $(srcdir)/kea-lfc.xml diff --git a/src/bin/perfdhcp/Makefile.am b/src/bin/perfdhcp/Makefile.am index 74d2975bab..6824093924 100644 --- a/src/bin/perfdhcp/Makefile.am +++ b/src/bin/perfdhcp/Makefile.am @@ -53,7 +53,7 @@ EXTRA_DIST += $(man_MANS) perfdhcp.xml if GENERATE_DOCS perfdhcp.8: perfdhcp.xml - @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/perfdhcp.xml + @XSLTPROC@ --novalid --xinclude -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/perfdhcp.xml else diff --git a/src/bin/sockcreator/Makefile.am b/src/bin/sockcreator/Makefile.am index 9fb4c96b3b..c96fd2498b 100644 --- a/src/bin/sockcreator/Makefile.am +++ b/src/bin/sockcreator/Makefile.am @@ -19,7 +19,7 @@ EXTRA_DIST = $(man_MANS) kea-sockcreator.xml if GENERATE_DOCS kea-sockcreator.8: kea-sockcreator.xml - @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/kea-sockcreator.xml + @XSLTPROC@ --novalid --xinclude -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/kea-sockcreator.xml else From 3d8fc42d32bd9b14a21e9a4aa521db14ba58075e Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Fri, 23 Dec 2016 19:04:06 +0200 Subject: [PATCH 04/11] minor changes --- .gitignore | 1 - doc/guide/Makefile.am | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 01711bbe70..4594d7c40c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ *.la *.lo *.o -*.dirstamp .deps/ .libs/ __pycache__/ diff --git a/doc/guide/Makefile.am b/doc/guide/Makefile.am index db750fe52e..84e7613186 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 From e4d6c5f5799e20c7e6e7fa3af653b01f795e6658 Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Tue, 10 Jan 2017 09:59:53 +0200 Subject: [PATCH 05/11] Added mysql_execute_script Doxygen documentation other minor changes --- src/bin/admin/admin-utils.sh | 20 ++++- .../d2/tests/d2_update_message_unittests.cc | 23 +++--- src/bin/d2/tests/dns_client_unittests.cc | 19 +++-- src/bin/dhcp4/dhcp4_messages.mes | 10 +-- src/bin/dhcp4/dhcp4_srv.h | 2 +- src/bin/dhcp4/dhcp4to6_ipc.cc | 4 +- src/bin/dhcp6/json_config_parser.cc | 2 +- src/lib/asiolink/io_address.h | 2 +- src/lib/cryptolink/tests/run_unittests.cc | 4 +- src/lib/dhcp/option6_pdexclude.cc | 1 - src/lib/dhcp/option_definition.cc | 3 +- .../dhcp/tests/option_definition_unittest.cc | 2 +- src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc | 13 ++-- src/lib/dhcpsrv/alloc_engine.h | 5 +- src/lib/dhcpsrv/base_host_data_source.h | 73 +++++++++---------- src/lib/dhcpsrv/dhcp4o6_ipc.cc | 2 +- src/lib/dhcpsrv/host_mgr.h | 5 +- src/lib/dhcpsrv/parsers/dhcp_parsers.cc | 3 +- src/lib/dhcpsrv/pgsql_connection.h | 10 +-- src/lib/dhcpsrv/subnet.h | 11 +-- .../tests/generic_lease_mgr_unittest.h | 14 ++-- src/lib/eval/eval_context.h | 2 +- src/lib/process/testutils/d_test_stubs.h | 2 +- src/lib/stats/stats_mgr.h | 2 +- 24 files changed, 119 insertions(+), 115 deletions(-) diff --git a/src/bin/admin/admin-utils.sh b/src/bin/admin/admin-utils.sh index 5c8be36f9b..ffb6a02e85 100755 --- a/src/bin/admin/admin-utils.sh +++ b/src/bin/admin/admin-utils.sh @@ -22,8 +22,22 @@ mysql_execute() { mysql -N -B "$@" -e "${QUERY}" retcode=$? else - mysql -N -B --database=${db_name} --user=${db_user} --password=${db_password} -e "${QUERY}" - 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 @@ -48,7 +62,7 @@ pgsql_execute() { QUERY=$1 shift if [ $# -gt 0 ]; then - echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q "#@" + echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q "$@" retcode=$? else export PGPASSWORD=$db_password diff --git a/src/bin/d2/tests/d2_update_message_unittests.cc b/src/bin/d2/tests/d2_update_message_unittests.cc index e8955bbb53..bdfef9e1e3 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 Return 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 @@ -282,7 +281,7 @@ TEST_F(D2UpdateMessageTest, fromWireInvalidOpcode) { }; // The 'true' argument passed to the constructor turns the // message into the parse mode in which the fromWire function - // can be used to decode the binary mesasage data. + // can be used to decode the binary message data. D2UpdateMessage msg(D2UpdateMessage::INBOUND); // When using invalid Opcode, the fromWire function should // throw NotUpdateMessage exception. @@ -306,7 +305,7 @@ TEST_F(D2UpdateMessageTest, fromWireInvalidQRFlag) { }; // The 'true' argument passed to the constructor turns the // message into the parse mode in which the fromWire function - // can be used to decode the binary mesasage data. + // can be used to decode the binary message data. D2UpdateMessage msg(D2UpdateMessage::INBOUND); // When using invalid QR flag, the fromWire function should // throw InvalidQRFlag exception. @@ -345,7 +344,7 @@ TEST_F(D2UpdateMessageTest, fromWireTooManyZones) { // The 'true' argument passed to the constructor turns the // message into the parse mode in which the fromWire function - // can be used to decode the binary mesasage data. + // can be used to decode the binary message data. D2UpdateMessage msg(D2UpdateMessage::INBOUND); // When parsing a message with more than one Zone record, // exception should be thrown. @@ -366,7 +365,7 @@ TEST_F(D2UpdateMessageTest, toWire) { // one Zone. toWire function would fail if Zone is not set. msg.setZone(Name("example.com"), RRClass::IN()); - // Set prerequisities. + // Set prerequisites. // 'Name Is Not In Use' prerequisite (RFC 2136, section 2.4.5) RRsetPtr prereq1(new RRset(Name("foo.example.com"), RRClass::NONE(), @@ -433,7 +432,7 @@ TEST_F(D2UpdateMessageTest, toWire) { EXPECT_EQ(1, buf.readUint16()); // PRCOUNT - holds the number of prerequisites. Earlier we have added - // two prerequisites. Thus, expect that this conter is 2. + // two prerequisites. Thus, expect that this counter is 2. EXPECT_EQ(2, buf.readUint16()); // UPCOUNT - holds the number of RRs in the Update Section. We have @@ -484,7 +483,7 @@ TEST_F(D2UpdateMessageTest, toWire) { // Check the name first. Message renderer is using compression for domain // names as described in RFC 1035, section 4.1.4. The name in this RR is - // foo.example.com. The name of the zone is example.com and it has occured + // foo.example.com. The name of the zone is example.com and it has occurred // in this message already at offset 12 (the size of the header is 12). // Therefore, name of this RR is encoded as 'foo', followed by a pointer // to offset in this message where the remainder of this name was used. @@ -566,7 +565,7 @@ TEST_F(D2UpdateMessageTest, toWireInvalidQRFlag) { // The 'true' argument passed to the constructor turns the // message into the parse mode in which the fromWire function - // can be used to decode the binary mesasage data. + // can be used to decode the binary message data. D2UpdateMessage msg(D2UpdateMessage::INBOUND); ASSERT_NO_THROW(msg.fromWire(bin_msg, sizeof(bin_msg))); diff --git a/src/bin/d2/tests/dns_client_unittests.cc b/src/bin/d2/tests/dns_client_unittests.cc index 0e784b49f3..d9206a0f04 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 @@ -219,7 +218,7 @@ public: dns::Message request(Message::PARSE); request.fromWire(received_data_buffer); - // If contex is not NULL, then we need to verify the message. + // If context is not NULL, then we need to verify the message. if (context) { TSIGError error = context->verify(request.getTSIGRecord(), receive_buffer_, receive_length); @@ -502,7 +501,7 @@ TEST_F(DNSClientTest, runTSIGTest) { // Neither client nor server will attempt to sign or verify. runTSIGTest(nokey, nokey); - // Client signs the request, server verfies but doesn't sign. + // Client signs the request, server verifies but doesn't sign. runTSIGTest(key_one, nokey, false); // Client and server use the same key to sign and verify. diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index 293fac72d3..61c9882196 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -201,6 +201,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 @@ -219,7 +223,7 @@ the message. % DHCP4_DHCP4O6_RECEIVING receiving DHCPv4o6 packet from DHCPv6 server This debug message is printed when the server is receiving a DHCPv4o6 -from the DHCPv6 server over inter-process communication socket. +from the DHCPv4 server over inter-process communication socket. % DHCP4_DHCP4O6_RESPONSE_DATA %1: responding with packet %2 (type %3), packet details: %4 A debug message including the detailed data about the packet being @@ -703,7 +707,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 013eaaed6f..6cf6643c17 100644 --- a/src/bin/dhcp4/dhcp4_srv.h +++ b/src/bin/dhcp4/dhcp4_srv.h @@ -225,7 +225,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 573078cb3e..c8725b7ea5 100644 --- a/src/bin/dhcp4/dhcp4to6_ipc.cc +++ b/src/bin/dhcp4/dhcp4to6_ipc.cc @@ -64,7 +64,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()); @@ -90,7 +90,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/dhcp6/json_config_parser.cc b/src/bin/dhcp6/json_config_parser.cc index 995390f4cc..68701170e0 100644 --- a/src/bin/dhcp6/json_config_parser.cc +++ b/src/bin/dhcp6/json_config_parser.cc @@ -230,7 +230,7 @@ public: } } - // @brief Commits the constructed local pool to the pool storage. + /// @brief Commits the constructed local pool to the pool storage. virtual void commit() { // Add the local pool to the external storage ptr. pools_->push_back(pool_); diff --git a/src/lib/asiolink/io_address.h b/src/lib/asiolink/io_address.h index 6a08575173..1d9326a586 100644 --- a/src/lib/asiolink/io_address.h +++ b/src/lib/asiolink/io_address.h @@ -136,7 +136,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/cryptolink/tests/run_unittests.cc b/src/lib/cryptolink/tests/run_unittests.cc index 59c202c718..6c92b190ca 100644 --- a/src/lib/cryptolink/tests/run_unittests.cc +++ b/src/lib/cryptolink/tests/run_unittests.cc @@ -4,11 +4,11 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#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 aa2d949f2c..a651a3d247 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 @@ -36,7 +37,6 @@ using namespace isc::util; namespace isc { namespace dhcp { - OptionDefinition::OptionDefinition(const std::string& name, const uint16_t code, const std::string& type, @@ -602,7 +602,6 @@ OptionDefinition::writeToBuffer(const std::string& value, << " 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 fbb67a9a3e..03ce31f61d 100644 --- a/src/lib/dhcp/tests/option_definition_unittest.cc +++ b/src/lib/dhcp/tests/option_definition_unittest.cc @@ -37,7 +37,7 @@ namespace { /// it around for the future. class OptionDefinitionTest : public ::testing::Test { public: - // @brief Constructor. + /// @brief Constructor. OptionDefinitionTest() { } }; diff --git a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc index b5f2c58379..eda0abcf21 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 c28775666c..c92ccfb8ff 100644 --- a/src/lib/dhcpsrv/alloc_engine.h +++ b/src/lib/dhcpsrv/alloc_engine.h @@ -1473,13 +1473,12 @@ 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. typedef boost::shared_ptr AllocEnginePtr; -}; // namespace isc::dhcp -}; // namespace isc +} // namespace dhcp +} // namespace isc #endif // ALLOC_ENGINE_H diff --git a/src/lib/dhcpsrv/base_host_data_source.h b/src/lib/dhcpsrv/base_host_data_source.h index 2fbd1aec84..5decdb3c1e 100644 --- a/src/lib/dhcpsrv/base_host_data_source.h +++ b/src/lib/dhcpsrv/base_host_data_source.h @@ -7,11 +7,14 @@ #ifndef BASE_HOST_DATA_SOURCE_H #define BASE_HOST_DATA_SOURCE_H -#include #include #include #include + +#include #include +#include + #include namespace isc { @@ -60,7 +63,7 @@ public: /// @brief Specifies the type of an identifier. /// /// This is currently used only by MySQL host data source for now, but - /// it is envisagad that it will be used by other host data sources + /// it is envisaged that it will be used by other host data sources /// in the future. Also, this list will grow over time. It is likely /// that we'll implement other identifiers in the future, e.g. remote-id. /// @@ -95,8 +98,8 @@ public: /// @param duid client id or NULL if not available, e.g. DHCPv4 client case. /// /// @return Collection of const @c Host objects. - virtual ConstHostCollection - getAll(const HWAddrPtr& hwaddr, const DuidPtr& duid = DuidPtr()) const = 0; + virtual ConstHostCollection getAll(const HWAddrPtr& hwaddr, + const DuidPtr& duid = DuidPtr()) const = 0; /// @brief Return all hosts connected to any subnet for which reservations /// have been made using a specified identifier. @@ -106,15 +109,14 @@ public: /// because a particular client may have reservations in multiple subnets. /// /// @param identifier_type Identifier type. - /// @param identifier_begin Pointer to a begining of a buffer containing + /// @param identifier_begin Pointer to a beginning of a buffer containing /// an identifier. /// @param identifier_len Identifier length. /// /// @return Collection of const @c Host objects. - virtual ConstHostCollection - getAll(const Host::IdentifierType& identifier_type, - const uint8_t* identifier_begin, - const size_t identifier_len) const = 0; + virtual ConstHostCollection getAll(const Host::IdentifierType& identifier_type, + const uint8_t* identifier_begin, + const size_t identifier_len) const = 0; /// @brief Returns a collection of hosts using the specified IPv4 address. /// @@ -124,13 +126,12 @@ public: /// @param address IPv4 address for which the @c Host object is searched. /// /// @return Collection of const @c Host objects. - virtual ConstHostCollection - getAll4(const asiolink::IOAddress& address) const = 0; + virtual ConstHostCollection getAll4(const asiolink::IOAddress& address) const = 0; /// @brief Returns a host connected to the IPv4 subnet. /// /// Implementations of this method should guard against the case when - /// mutliple instances of the @c Host are present, e.g. when two + /// multiple instances of the @c Host are present, e.g. when two /// @c Host objects are found, one for the DUID, another one for the /// HW address. In such case, an implementation of this method /// should throw an exception. @@ -141,26 +142,24 @@ public: /// @param duid client id or NULL if not available. /// /// @return Const @c Host object using a specified HW address or DUID. - virtual ConstHostPtr - get4(const SubnetID& subnet_id, const HWAddrPtr& hwaddr, - const DuidPtr& duid = DuidPtr()) const = 0; + virtual ConstHostPtr get4(const SubnetID& subnet_id, const HWAddrPtr& hwaddr, + const DuidPtr& duid = DuidPtr()) const = 0; /// @brief Returns a host connected to the IPv4 subnet. /// /// @param subnet_id Subnet identifier. /// @param identifier_type Identifier type. - /// @param identifier_begin Pointer to a begining of a buffer containing + /// @param identifier_begin Pointer to a beginning of a buffer containing /// an identifier. /// @param identifier_len Identifier length. /// /// @return Const @c Host object for which reservation has been made using /// the specified identifier. - virtual ConstHostPtr - get4(const SubnetID& subnet_id, - const Host::IdentifierType& identifier_type, - const uint8_t* identifier_begin, - const size_t identifier_len) const = 0; + virtual ConstHostPtr get4(const SubnetID& subnet_id, + const Host::IdentifierType& identifier_type, + const uint8_t* identifier_begin, + const size_t identifier_len) const = 0; /// @brief Returns a host connected to the IPv4 subnet and having /// a reservation for a specified IPv4 address. @@ -178,14 +177,13 @@ public: /// @param address reserved IPv4 address. /// /// @return Const @c Host object using a specified IPv4 address. - virtual ConstHostPtr - get4(const SubnetID& subnet_id, - const asiolink::IOAddress& address) const = 0; + virtual ConstHostPtr get4(const SubnetID& subnet_id, + const asiolink::IOAddress& address) const = 0; /// @brief Returns a host connected to the IPv6 subnet. /// /// Implementations of this method should guard against the case when - /// mutliple instances of the @c Host are present, e.g. when two + /// multiple instances of the @c Host are present, e.g. when two /// @c Host objects are found, one for the DUID, another one for the /// HW address. In such case, an implementation of this method /// should throw an exception. @@ -196,25 +194,24 @@ public: /// @param duid DUID or NULL if not available. /// /// @return Const @c Host object using a specified HW address or DUID. - virtual ConstHostPtr - get6(const SubnetID& subnet_id, const DuidPtr& duid, - const HWAddrPtr& hwaddr = HWAddrPtr()) const = 0; + virtual ConstHostPtr get6(const SubnetID& subnet_id, + const DuidPtr& duid, + const HWAddrPtr& hwaddr = HWAddrPtr()) const = 0; /// @brief Returns a host connected to the IPv6 subnet. /// /// @param subnet_id Subnet identifier. /// @param identifier_type Identifier type. - /// @param identifier_begin Pointer to a begining of a buffer containing + /// @param identifier_begin Pointer to a beginning of a buffer containing /// an identifier. /// @param identifier_len Identifier length. /// /// @return Const @c Host object for which reservation has been made using /// the specified identifier. - virtual ConstHostPtr - get6(const SubnetID& subnet_id, - const Host::IdentifierType& identifier_type, - const uint8_t* identifier_begin, - const size_t identifier_len) const = 0; + virtual ConstHostPtr get6(const SubnetID& subnet_id, + const Host::IdentifierType& identifier_type, + const uint8_t* identifier_begin, + const size_t identifier_len) const = 0; /// @brief Returns a host using the specified IPv6 prefix. /// @@ -222,8 +219,8 @@ public: /// @param prefix_len IPv6 prefix length. /// /// @return Const @c Host object using a specified HW address or DUID. - virtual ConstHostPtr - get6(const asiolink::IOAddress& prefix, const uint8_t prefix_len) const = 0; + virtual ConstHostPtr get6(const asiolink::IOAddress& prefix, + const uint8_t prefix_len) const = 0; /// @brief Returns a host connected to the IPv6 subnet and having /// a reservation for a specified IPv6 address or prefix. @@ -270,7 +267,7 @@ public: /// @brief HostDataSource pointer typedef boost::shared_ptr HostDataSourcePtr; -} -} +} // namespace dhcp +} // namespace isc #endif // BASE_HOST_DATA_SOURCE_H 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/host_mgr.h b/src/lib/dhcpsrv/host_mgr.h index f7483fe074..128b311f4b 100644 --- a/src/lib/dhcpsrv/host_mgr.h +++ b/src/lib/dhcpsrv/host_mgr.h @@ -284,7 +284,8 @@ private: static boost::scoped_ptr& getHostMgrPtr(); }; -} -} + +} // namespace dhcp +} // namespace isc #endif // HOST_MGR_H diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc index 12f1590e18..f6aa0f7639 100644 --- a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc @@ -1233,8 +1233,7 @@ SubnetConfigParser::build(ConstElementPtr subnet) { Subnet::HRMode SubnetConfigParser::hrModeFromText(const std::string& txt) { - if ( (txt.compare("disabled") == 0) || - (txt.compare("off") == 0) ) { + if ( (txt.compare("disabled") == 0) || (txt.compare("off") == 0) ) { return (Subnet::HR_DISABLED); } else if (txt.compare("out-of-pool") == 0) { return (Subnet::HR_OUT_OF_POOL); diff --git a/src/lib/dhcpsrv/pgsql_connection.h b/src/lib/dhcpsrv/pgsql_connection.h index b0d793b611..8e7fe884c8 100644 --- a/src/lib/dhcpsrv/pgsql_connection.h +++ b/src/lib/dhcpsrv/pgsql_connection.h @@ -23,7 +23,7 @@ namespace dhcp { // statement. const size_t PGSQL_MAX_PARAMETERS_IN_QUERY = 32; -/// @brief Defines 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. @@ -45,8 +45,9 @@ struct PgSqlTaggedStatement { const char* text; }; +/// @{ /// @brief Constants for PostgreSQL data types -/// This are defined by PostreSQL in , but including +/// This are defined by PostgreSQL in , but including /// this file is extraordinarily convoluted, so we'll use these to fill-in. const size_t OID_NONE = 0; // PostgreSQL infers proper type const size_t OID_BOOL = 16; @@ -57,8 +58,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 Posgtresql Result sets /// @@ -289,7 +289,7 @@ private: /// that use instances of PgSqlConnection. class PgSqlConnection : public DatabaseConnection { public: - /// @brief Defines 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/subnet.h b/src/lib/dhcpsrv/subnet.h index 484905688e..f4c083bf75 100644 --- a/src/lib/dhcpsrv/subnet.h +++ b/src/lib/dhcpsrv/subnet.h @@ -299,16 +299,14 @@ public: /// /// @param client_classes list of all classes the client belongs to /// @return true if client can be supported, false otherwise - bool - clientSupported(const isc::dhcp::ClientClasses& client_classes) const; + bool clientSupported(const isc::dhcp::ClientClasses& client_classes) const; /// @brief adds class class_name to the list of supported classes /// /// Also see explanation note in @ref white_list_. /// /// @param class_name client class to be supported by this subnet - void - allowClientClass(const isc::dhcp::ClientClass& class_name); + void allowClientClass(const isc::dhcp::ClientClass& class_name); /// @brief Specifies what type of Host Reservations are supported. /// @@ -318,8 +316,7 @@ public: /// performance reasons. /// /// @return whether in-pool host reservations are allowed. - HRMode - getHostReservationMode() const { + HRMode getHostReservationMode() const { return (host_reservation_mode_); } @@ -496,8 +493,8 @@ protected: /// /// See @ref HRMode type for details. HRMode host_reservation_mode_; -private: +private: /// @brief Pointer to the option data configuration for this subnet. CfgOptionPtr cfg_option_; }; diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h index f426787833..a5dd8ce365 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 @@ -393,8 +393,8 @@ public: LeaseMgr* lmptr_; }; -}; // namespace test -}; // namespace dhcp -}; // namespace isc +} // namespace test +} // namespace dhcp +} // namespace isc #endif diff --git a/src/lib/eval/eval_context.h b/src/lib/eval/eval_context.h index 5ced06cb1d..e0a938bfaf 100644 --- a/src/lib/eval/eval_context.h +++ b/src/lib/eval/eval_context.h @@ -149,7 +149,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 83953d4103..99c68a3d89 100644 --- a/src/lib/process/testutils/d_test_stubs.h +++ b/src/lib/process/testutils/d_test_stubs.h @@ -181,7 +181,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 86ce9bd2ba..c5e5c7abc0 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 From 7ca388d0c54dc9ac61ac002e21f0222675e9c0d9 Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Thu, 17 Aug 2017 21:10:28 +0300 Subject: [PATCH 06/11] Added --nonet back --- configure.ac | 4 ++-- doc/guide/Makefile.am | 4 ++-- src/bin/admin/Makefile.am | 2 +- src/bin/d2/Makefile.am | 2 +- src/bin/dhcp4/Makefile.am | 2 +- src/bin/keactrl/Makefile.am | 2 +- src/bin/lfc/Makefile.am | 2 +- src/bin/perfdhcp/Makefile.am | 2 +- src/bin/sockcreator/Makefile.am | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index bba2cc942a..7bcc8197a4 100644 --- a/configure.ac +++ b/configure.ac @@ -1488,11 +1488,11 @@ if test "x$enable_generate_docs" != xno ; then else AC_MSG_CHECKING([if $XSLTPROC works]) # run xsltproc to see if works - $XSLTPROC --novalid --xinclude http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl + $XSLTPROC --novalid --xinclude --nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl if test $? -ne 0 ; then AC_MSG_ERROR("Error with $XSLTPROC using release/xsl/current/manpages/docbook.xsl") fi - $XSLTPROC --novalid --xinclude http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl + $XSLTPROC --novalid --xinclude --nonet http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl if test $? -ne 0 ; then AC_MSG_ERROR("Error with $XSLTPROC using release/xsl/current/html/docbook.xsl") fi diff --git a/doc/guide/Makefile.am b/doc/guide/Makefile.am index 6e7ffc321f..b969ca5b01 100644 --- a/doc/guide/Makefile.am +++ b/doc/guide/Makefile.am @@ -22,7 +22,7 @@ kea-messages.xml: if GENERATE_DOCS kea-guide.html: $(DOCBOOK) - @XSLTPROC@ --novalid --xinclude \ + @XSLTPROC@ --novalid --xinclude --nonet \ --path $(top_builddir)/doc \ -o $@ \ --stringparam section.autolabel 1 \ @@ -35,7 +35,7 @@ kea-guide.txt: kea-guide.html @ELINKS@ -dump -no-numbering -no-references kea-guide.html > $@ kea-messages.html: kea-messages.xml - @XSLTPROC@ --novalid --xinclude \ + @XSLTPROC@ --novalid --xinclude --nonet \ --path $(top_builddir)/doc \ -o $@ \ --stringparam generate.toc "book toc" \ diff --git a/src/bin/admin/Makefile.am b/src/bin/admin/Makefile.am index 775e4cee2f..a71ee1c737 100644 --- a/src/bin/admin/Makefile.am +++ b/src/bin/admin/Makefile.am @@ -10,7 +10,7 @@ EXTRA_DIST = $(man_MANS) kea-admin.xml admin-utils.sh if GENERATE_DOCS kea-admin.8: kea-admin.xml - @XSLTPROC@ --novalid --xinclude -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/kea-admin.xml + @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/kea-admin.xml else diff --git a/src/bin/d2/Makefile.am b/src/bin/d2/Makefile.am index 5d27033607..e8eeb85314 100644 --- a/src/bin/d2/Makefile.am +++ b/src/bin/d2/Makefile.am @@ -36,7 +36,7 @@ EXTRA_DIST += images/trans_classes.svg images/update_exec_classes.svg if GENERATE_DOCS kea-dhcp-ddns.8: kea-dhcp-ddns.xml - @XSLTPROC@ --novalid --xinclude -o $@ \ + @XSLTPROC@ --novalid --xinclude --nonet -o $@ \ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \ $(srcdir)/kea-dhcp-ddns.xml diff --git a/src/bin/dhcp4/Makefile.am b/src/bin/dhcp4/Makefile.am index 5ac0c15e9c..c75a39a21d 100644 --- a/src/bin/dhcp4/Makefile.am +++ b/src/bin/dhcp4/Makefile.am @@ -30,7 +30,7 @@ EXTRA_DIST += dhcp4_parser.yy if GENERATE_DOCS kea-dhcp4.8: kea-dhcp4.xml - @XSLTPROC@ --novalid --xinclude -o $@ \ + @XSLTPROC@ --novalid --xinclude --nonet -o $@ \ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \ $(srcdir)/kea-dhcp4.xml diff --git a/src/bin/keactrl/Makefile.am b/src/bin/keactrl/Makefile.am index 223a6e1939..c83a597457 100644 --- a/src/bin/keactrl/Makefile.am +++ b/src/bin/keactrl/Makefile.am @@ -19,7 +19,7 @@ BUILT_SOURCES = kea.conf if GENERATE_DOCS keactrl.8: keactrl.xml - @XSLTPROC@ --novalid --xinclude -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/keactrl.xml + @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/keactrl.xml else diff --git a/src/bin/lfc/Makefile.am b/src/bin/lfc/Makefile.am index 91dee0672b..7bfeb96df7 100644 --- a/src/bin/lfc/Makefile.am +++ b/src/bin/lfc/Makefile.am @@ -17,7 +17,7 @@ EXTRA_DIST = $(man_MANS) kea-lfc.xml lfc.dox if GENERATE_DOCS kea-lfc.8: kea-lfc.xml - @XSLTPROC@ --novalid --xinclude -o $@ \ + @XSLTPROC@ --novalid --xinclude --nonet -o $@ \ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \ $(srcdir)/kea-lfc.xml diff --git a/src/bin/perfdhcp/Makefile.am b/src/bin/perfdhcp/Makefile.am index 6824093924..74d2975bab 100644 --- a/src/bin/perfdhcp/Makefile.am +++ b/src/bin/perfdhcp/Makefile.am @@ -53,7 +53,7 @@ EXTRA_DIST += $(man_MANS) perfdhcp.xml if GENERATE_DOCS perfdhcp.8: perfdhcp.xml - @XSLTPROC@ --novalid --xinclude -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/perfdhcp.xml + @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/perfdhcp.xml else diff --git a/src/bin/sockcreator/Makefile.am b/src/bin/sockcreator/Makefile.am index c96fd2498b..9fb4c96b3b 100644 --- a/src/bin/sockcreator/Makefile.am +++ b/src/bin/sockcreator/Makefile.am @@ -19,7 +19,7 @@ EXTRA_DIST = $(man_MANS) kea-sockcreator.xml if GENERATE_DOCS kea-sockcreator.8: kea-sockcreator.xml - @XSLTPROC@ --novalid --xinclude -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/kea-sockcreator.xml + @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/kea-sockcreator.xml else From dc5303592424c8eccffcc012da7c745a089d4e7c Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Fri, 18 Aug 2017 09:44:29 +0300 Subject: [PATCH 07/11] reverted some changes which are too pedantic --- configure.ac | 4 +- .../d2/tests/d2_update_message_unittests.cc | 8 +-- src/bin/d2/tests/dns_client_unittests.cc | 12 ++-- src/bin/dhcp4/dhcp4to6_ipc.cc | 2 +- .../dhcp/tests/option_definition_unittest.cc | 6 +- src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc | 4 +- src/lib/dhcpsrv/alloc_engine.h | 4 +- src/lib/dhcpsrv/base_host_data_source.h | 61 ++++++++++--------- src/lib/dhcpsrv/host_mgr.h | 5 +- src/lib/dhcpsrv/parsers/dhcp_parsers.cc | 3 +- src/lib/dhcpsrv/subnet.h | 11 ++-- .../tests/generic_lease_mgr_unittest.h | 6 +- 12 files changed, 66 insertions(+), 60 deletions(-) diff --git a/configure.ac b/configure.ac index 7bcc8197a4..bba2cc942a 100644 --- a/configure.ac +++ b/configure.ac @@ -1488,11 +1488,11 @@ if test "x$enable_generate_docs" != xno ; then else AC_MSG_CHECKING([if $XSLTPROC works]) # run xsltproc to see if works - $XSLTPROC --novalid --xinclude --nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl + $XSLTPROC --novalid --xinclude http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl if test $? -ne 0 ; then AC_MSG_ERROR("Error with $XSLTPROC using release/xsl/current/manpages/docbook.xsl") fi - $XSLTPROC --novalid --xinclude --nonet http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl + $XSLTPROC --novalid --xinclude http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl if test $? -ne 0 ; then AC_MSG_ERROR("Error with $XSLTPROC using release/xsl/current/html/docbook.xsl") fi diff --git a/src/bin/d2/tests/d2_update_message_unittests.cc b/src/bin/d2/tests/d2_update_message_unittests.cc index c43ac94426..6e6fa5d949 100644 --- a/src/bin/d2/tests/d2_update_message_unittests.cc +++ b/src/bin/d2/tests/d2_update_message_unittests.cc @@ -25,20 +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 91c3e8eff0..74ddecc2df 100644 --- a/src/bin/d2/tests/dns_client_unittests.cc +++ b/src/bin/d2/tests/dns_client_unittests.cc @@ -36,7 +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 @@ -63,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 @@ -87,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. @@ -132,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() { @@ -140,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. diff --git a/src/bin/dhcp4/dhcp4to6_ipc.cc b/src/bin/dhcp4/dhcp4to6_ipc.cc index 39188c2012..1db3cb5e5d 100644 --- a/src/bin/dhcp4/dhcp4to6_ipc.cc +++ b/src/bin/dhcp4/dhcp4to6_ipc.cc @@ -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/lib/dhcp/tests/option_definition_unittest.cc b/src/lib/dhcp/tests/option_definition_unittest.cc index 8b7f827218..7a517f181a 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() { } }; @@ -1603,7 +1603,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 @@ -1632,7 +1632,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 e6ac57a739..7d492cbfc6 100644 --- a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc +++ b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc @@ -218,7 +218,7 @@ public: received_ncr_ = ncr; } - /// @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() { @@ -657,7 +657,7 @@ public: sent_ncrs_.push_back(ncr); } - /// @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() { diff --git a/src/lib/dhcpsrv/alloc_engine.h b/src/lib/dhcpsrv/alloc_engine.h index 3f3623118b..dfec61f8d6 100644 --- a/src/lib/dhcpsrv/alloc_engine.h +++ b/src/lib/dhcpsrv/alloc_engine.h @@ -1478,7 +1478,7 @@ private: /// @brief A pointer to the @c AllocEngine object. typedef boost::shared_ptr AllocEnginePtr; -} // namespace dhcp -} // namespace isc +}; // namespace isc::dhcp +}; // namespace isc #endif // ALLOC_ENGINE_H diff --git a/src/lib/dhcpsrv/base_host_data_source.h b/src/lib/dhcpsrv/base_host_data_source.h index e4d153ea6d..2e3ed16db1 100644 --- a/src/lib/dhcpsrv/base_host_data_source.h +++ b/src/lib/dhcpsrv/base_host_data_source.h @@ -7,14 +7,11 @@ #ifndef BASE_HOST_DATA_SOURCE_H #define BASE_HOST_DATA_SOURCE_H +#include #include #include #include - -#include #include -#include - #include namespace isc { @@ -98,8 +95,8 @@ public: /// @param duid client id or NULL if not available, e.g. DHCPv4 client case. /// /// @return Collection of const @c Host objects. - virtual ConstHostCollection getAll(const HWAddrPtr& hwaddr, - const DuidPtr& duid = DuidPtr()) const = 0; + virtual ConstHostCollection + getAll(const HWAddrPtr& hwaddr, const DuidPtr& duid = DuidPtr()) const = 0; /// @brief Return all hosts connected to any subnet for which reservations /// have been made using a specified identifier. @@ -114,9 +111,10 @@ public: /// @param identifier_len Identifier length. /// /// @return Collection of const @c Host objects. - virtual ConstHostCollection getAll(const Host::IdentifierType& identifier_type, - const uint8_t* identifier_begin, - const size_t identifier_len) const = 0; + virtual ConstHostCollection + getAll(const Host::IdentifierType& identifier_type, + const uint8_t* identifier_begin, + const size_t identifier_len) const = 0; /// @brief Returns a collection of hosts using the specified IPv4 address. /// @@ -126,7 +124,8 @@ public: /// @param address IPv4 address for which the @c Host object is searched. /// /// @return Collection of const @c Host objects. - virtual ConstHostCollection getAll4(const asiolink::IOAddress& address) const = 0; + virtual ConstHostCollection + getAll4(const asiolink::IOAddress& address) const = 0; /// @brief Returns a host connected to the IPv4 subnet. /// @@ -142,8 +141,9 @@ public: /// @param duid client id or NULL if not available. /// /// @return Const @c Host object using a specified HW address or DUID. - virtual ConstHostPtr get4(const SubnetID& subnet_id, const HWAddrPtr& hwaddr, - const DuidPtr& duid = DuidPtr()) const = 0; + virtual ConstHostPtr + get4(const SubnetID& subnet_id, const HWAddrPtr& hwaddr, + const DuidPtr& duid = DuidPtr()) const = 0; /// @brief Returns a host connected to the IPv4 subnet. @@ -156,10 +156,11 @@ public: /// /// @return Const @c Host object for which reservation has been made using /// the specified identifier. - virtual ConstHostPtr get4(const SubnetID& subnet_id, - const Host::IdentifierType& identifier_type, - const uint8_t* identifier_begin, - const size_t identifier_len) const = 0; + virtual ConstHostPtr + get4(const SubnetID& subnet_id, + const Host::IdentifierType& identifier_type, + const uint8_t* identifier_begin, + const size_t identifier_len) const = 0; /// @brief Returns a host connected to the IPv4 subnet and having /// a reservation for a specified IPv4 address. @@ -177,8 +178,9 @@ public: /// @param address reserved IPv4 address. /// /// @return Const @c Host object using a specified IPv4 address. - virtual ConstHostPtr get4(const SubnetID& subnet_id, - const asiolink::IOAddress& address) const = 0; + virtual ConstHostPtr + get4(const SubnetID& subnet_id, + const asiolink::IOAddress& address) const = 0; /// @brief Returns a host connected to the IPv6 subnet. /// @@ -194,9 +196,9 @@ public: /// @param duid DUID or NULL if not available. /// /// @return Const @c Host object using a specified HW address or DUID. - virtual ConstHostPtr get6(const SubnetID& subnet_id, - const DuidPtr& duid, - const HWAddrPtr& hwaddr = HWAddrPtr()) const = 0; + virtual ConstHostPtr + get6(const SubnetID& subnet_id, const DuidPtr& duid, + const HWAddrPtr& hwaddr = HWAddrPtr()) const = 0; /// @brief Returns a host connected to the IPv6 subnet. /// @@ -208,10 +210,11 @@ public: /// /// @return Const @c Host object for which reservation has been made using /// the specified identifier. - virtual ConstHostPtr get6(const SubnetID& subnet_id, - const Host::IdentifierType& identifier_type, - const uint8_t* identifier_begin, - const size_t identifier_len) const = 0; + virtual ConstHostPtr + get6(const SubnetID& subnet_id, + const Host::IdentifierType& identifier_type, + const uint8_t* identifier_begin, + const size_t identifier_len) const = 0; /// @brief Returns a host using the specified IPv6 prefix. /// @@ -219,8 +222,8 @@ public: /// @param prefix_len IPv6 prefix length. /// /// @return Const @c Host object using a specified HW address or DUID. - virtual ConstHostPtr get6(const asiolink::IOAddress& prefix, - const uint8_t prefix_len) const = 0; + virtual ConstHostPtr + get6(const asiolink::IOAddress& prefix, const uint8_t prefix_len) const = 0; /// @brief Returns a host connected to the IPv6 subnet and having /// a reservation for a specified IPv6 address or prefix. @@ -307,7 +310,7 @@ public: /// @brief HostDataSource pointer typedef boost::shared_ptr HostDataSourcePtr; -} // namespace dhcp -} // namespace isc +} +} #endif // BASE_HOST_DATA_SOURCE_H diff --git a/src/lib/dhcpsrv/host_mgr.h b/src/lib/dhcpsrv/host_mgr.h index dd5177a3dd..c177f58829 100644 --- a/src/lib/dhcpsrv/host_mgr.h +++ b/src/lib/dhcpsrv/host_mgr.h @@ -337,8 +337,7 @@ private: static boost::scoped_ptr& getHostMgrPtr(); }; - -} // namespace dhcp -} // namespace isc +} +} #endif // HOST_MGR_H diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc index 1a91cdb357..30995de0d0 100644 --- a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc @@ -523,7 +523,8 @@ SubnetConfigParser::parse(ConstElementPtr subnet) { Subnet::HRMode SubnetConfigParser::hrModeFromText(const std::string& txt) { - if ( (txt.compare("disabled") == 0) || (txt.compare("off") == 0) ) { + if ( (txt.compare("disabled") == 0) || + (txt.compare("off") == 0) ) { return (Subnet::HR_DISABLED); } else if (txt.compare("out-of-pool") == 0) { return (Subnet::HR_OUT_OF_POOL); diff --git a/src/lib/dhcpsrv/subnet.h b/src/lib/dhcpsrv/subnet.h index e11187bfa3..3d91ae8bb9 100644 --- a/src/lib/dhcpsrv/subnet.h +++ b/src/lib/dhcpsrv/subnet.h @@ -306,14 +306,16 @@ public: /// /// @param client_classes list of all classes the client belongs to /// @return true if client can be supported, false otherwise - bool clientSupported(const isc::dhcp::ClientClasses& client_classes) const; + bool + clientSupported(const isc::dhcp::ClientClasses& client_classes) const; /// @brief adds class class_name to the list of supported classes /// /// Also see explanation note in @ref white_list_. /// /// @param class_name client class to be supported by this subnet - void allowClientClass(const isc::dhcp::ClientClass& class_name); + void + allowClientClass(const isc::dhcp::ClientClass& class_name); /// @brief returns the client class white list /// @@ -333,7 +335,8 @@ public: /// performance reasons. /// /// @return whether in-pool host reservations are allowed. - HRMode getHostReservationMode() const { + HRMode + getHostReservationMode() const { return (host_reservation_mode_); } @@ -515,8 +518,8 @@ protected: /// /// See @ref HRMode type for details. HRMode host_reservation_mode_; - private: + /// @brief Pointer to the option data configuration for this subnet. CfgOptionPtr cfg_option_; }; diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h index c2a77d31b5..a1bbd9a45b 100644 --- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h +++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h @@ -406,8 +406,8 @@ public: LeaseMgr* lmptr_; }; -} // namespace test -} // namespace dhcp -} // namespace isc +}; // namespace test +}; // namespace dhcp +}; // namespace isc #endif From 6e5ddf2725b14d37f3ee1755352f1bb206f04687 Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Fri, 18 Aug 2017 10:27:29 +0300 Subject: [PATCH 08/11] minor changes: * dynamic exception specifications are deprecated in C++11 (throw on function definition) * INSTANTIATE_TEST_CASE_P gives a warning about variadic arguments having at least one argument. The IntToString functor is what it requires for test cases to be displayed correctly. * Options should be merged with formatted option included in the identifier. This was unit-tested, but masked by an incorrect csv-format value in test data. Merge not used in actual code, but used in Cassandra PR. * ifdefs in MACROS are not portable * added missing doxygen comments --- src/bin/dhcp4/tests/get_config_unittest.cc | 24 +++++++++++------ .../dhcp4/tests/get_config_unittest.cc.skel | 16 ++++++++--- src/bin/dhcp6/tests/get_config_unittest.cc | 26 +++++++++++------- .../dhcp6/tests/get_config_unittest.cc.skel | 16 ++++++++--- src/lib/cc/data.cc | 7 +++-- src/lib/cc/data.h | 11 +++----- src/lib/config/module_spec.cc | 9 +++---- src/lib/config/module_spec.h | 17 +++++------- src/lib/dhcpsrv/cfg_option.cc | 14 +++++----- src/lib/dhcpsrv/mysql_host_data_source.h | 27 ++++++++++++++----- .../util/threads/tests/condvar_unittest.cc | 6 ++--- src/lib/util/threads/tests/lock_unittest.cc | 6 ++--- 12 files changed, 106 insertions(+), 73 deletions(-) diff --git a/src/bin/dhcp4/tests/get_config_unittest.cc b/src/bin/dhcp4/tests/get_config_unittest.cc index 0aff18e76e..92f618985d 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc +++ b/src/bin/dhcp4/tests/get_config_unittest.cc @@ -5982,7 +5982,7 @@ outputFormatted(const std::string& config) { } } -}; +} // namespace namespace isc { namespace dhcp { @@ -6013,9 +6013,9 @@ extractConfig(const std::string& config) { ++extract_count; } -}; -}; -}; +} // namespace test +} // namespace dhcp +} // namespace isc namespace { @@ -6199,8 +6199,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 825a6d62ab..0c23840871 100644 --- a/src/bin/dhcp4/tests/get_config_unittest.cc.skel +++ b/src/bin/dhcp4/tests/get_config_unittest.cc.skel @@ -338,8 +338,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/tests/get_config_unittest.cc b/src/bin/dhcp6/tests/get_config_unittest.cc index 901e954336..223d29b6c6 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc +++ b/src/bin/dhcp6/tests/get_config_unittest.cc @@ -3204,7 +3204,7 @@ const char* UNPARSED_CONFIGS[] = { " {\n" " \"always-send\": false,\n" " \"code\": 7,\n" -" \"csv-format\": false,\n" +" \"csv-format\": true,\n" " \"data\": \"01\",\n" " \"name\": \"preference\",\n" " \"space\": \"dhcp6\"\n" @@ -5831,7 +5831,7 @@ outputFormatted(const std::string& config) { } } -}; +} namespace isc { namespace dhcp { @@ -5862,9 +5862,9 @@ extractConfig(const std::string& config) { ++extract_count; } -}; -}; -}; +} // namespace test +} // namespace dhcp +} // namespace isc namespace { @@ -6051,8 +6051,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 93604ed6c9..59d9d722a6 100644 --- a/src/bin/dhcp6/tests/get_config_unittest.cc.skel +++ b/src/bin/dhcp6/tests/get_config_unittest.cc.skel @@ -341,8 +341,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/lib/cc/data.cc b/src/lib/cc/data.cc index 4a83e688e0..836923a5d9 100644 --- a/src/lib/cc/data.cc +++ b/src/lib/cc/data.cc @@ -608,7 +608,7 @@ Element::nameToType(const std::string& type_name) { } ElementPtr -Element::fromJSON(std::istream& in, bool preproc) throw(JSONError) { +Element::fromJSON(std::istream& in, bool preproc) { int line = 1, pos = 1; stringstream filtered; @@ -623,7 +623,6 @@ Element::fromJSON(std::istream& in, bool preproc) throw(JSONError) { ElementPtr Element::fromJSON(std::istream& in, const std::string& file_name, bool preproc) - throw(JSONError) { int line = 1, pos = 1; stringstream filtered; @@ -635,7 +634,7 @@ Element::fromJSON(std::istream& in, const std::string& file_name, bool preproc) ElementPtr Element::fromJSON(std::istream& in, const std::string& file, int& line, - int& pos) throw(JSONError) + int& pos) { int c = 0; ElementPtr element; @@ -1236,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/cc/data.h b/src/lib/cc/data.h index d609615e9b..36e7c0f26c 100644 --- a/src/lib/cc/data.h +++ b/src/lib/cc/data.h @@ -427,8 +427,7 @@ public: /// should be performed /// @return An ElementPtr that contains the element(s) specified /// in the given input stream. - static ElementPtr fromJSON(std::istream& in, bool preproc = false) - throw(JSONError); + static ElementPtr fromJSON(std::istream& in, bool preproc = false); /// Creates an Element from the given input stream containing JSON /// formatted data. @@ -440,8 +439,7 @@ public: /// @return An ElementPtr that contains the element(s) specified /// in the given input stream. static ElementPtr fromJSON(std::istream& in, const std::string& file_name, - bool preproc = false) - throw(JSONError); + bool preproc = false); /// Creates an Element from the given input stream, where we keep /// track of the location in the stream for error reporting. @@ -456,8 +454,7 @@ public: /// in the given input stream. // make this one private? static ElementPtr fromJSON(std::istream& in, const std::string& file, - int& line, int &pos) - throw(JSONError); + int& line, int &pos); /// Reads contents of specified file and interprets it as JSON. /// @@ -742,7 +739,7 @@ void merge(ElementPtr element, ConstElementPtr other); /// negative means outbound and perhaps looping forever). /// @return a pointer to a fresh copy /// \throw raises a BadValue is a null pointer occurs. -ElementPtr copy(ConstElementPtr from, int level = 100); +ElementPtr copy(ConstElementPtr from, int level = 100); /// @brief Compares the data with other using unordered lists /// diff --git a/src/lib/config/module_spec.cc b/src/lib/config/module_spec.cc index 0c9613b2b4..b9f135082f 100644 --- a/src/lib/config/module_spec.cc +++ b/src/lib/config/module_spec.cc @@ -188,8 +188,7 @@ namespace config { ModuleSpec::ModuleSpec(ConstElementPtr module_spec_element, const bool check) - throw(ModuleSpecError) - + { module_specification = module_spec_element; if (check) { @@ -298,7 +297,6 @@ ModuleSpec::validateStatistics(ConstElementPtr data, const bool full, ModuleSpec moduleSpecFromFile(const std::string& file_name, const bool check) - throw(JSONError, ModuleSpecError) { std::ifstream file; @@ -322,7 +320,6 @@ moduleSpecFromFile(const std::string& file_name, const bool check) ModuleSpec moduleSpecFromFile(std::ifstream& in, const bool check) - throw(JSONError, ModuleSpecError) { ConstElementPtr module_spec_element = Element::fromJSON(in); if (module_spec_element->contains("module_spec")) { @@ -439,7 +436,7 @@ ModuleSpec::validateSpec(ConstElementPtr spec, ConstElementPtr data, bool optional = spec->get("item_optional")->boolValue(); ConstElementPtr data_el; data_el = data->get(item_name); - + if (data_el) { if (!validateItem(spec, data_el, full, errors)) { return (false); @@ -468,7 +465,7 @@ ModuleSpec::validateSpecList(ConstElementPtr spec, ConstElementPtr data, } typedef std::pair maptype; - + BOOST_FOREACH(maptype m, data->mapValue()) { // Ignore 'version' as a config element if (m.first.compare("version") != 0) { diff --git a/src/lib/config/module_spec.h b/src/lib/config/module_spec.h index ef8c2a287b..591e826c04 100644 --- a/src/lib/config/module_spec.h +++ b/src/lib/config/module_spec.h @@ -43,8 +43,7 @@ namespace isc { namespace config { /// \param check If false, the module specification in the file /// is not checked to be of the correct form. explicit ModuleSpec(isc::data::ConstElementPtr e, - const bool check = true) - throw(ModuleSpecError); + const bool check = true); /// Returns the commands part of the specification as an /// ElementPtr, returns an empty ElementPtr if there is none @@ -72,11 +71,11 @@ namespace isc { namespace config { /// Returns the module name as specified by the specification const std::string getModuleName() const; - + /// Returns the module description as specified by the specification /// returns an empty string if there is no description const std::string getModuleDescription() const; - + // returns true if the given element conforms to this data // configuration specification /// Validates the given configuration data for this specification. @@ -176,8 +175,7 @@ namespace isc { namespace config { /// \param check If true, the module specification in the file /// is checked to be of the correct form ModuleSpec - moduleSpecFromFile(const std::string& file_name, const bool check = true) - throw(isc::data::JSONError, ModuleSpecError); + moduleSpecFromFile(const std::string& file_name, const bool check = true); /// Creates a \c ModuleSpec instance from the given input /// stream that contains the contents of a .spec file. @@ -188,12 +186,11 @@ namespace isc { namespace config { /// \param check If true, the module specification is checked /// to be of the correct form ModuleSpec - moduleSpecFromFile(std::ifstream& in, const bool check = true) - throw(isc::data::JSONError, ModuleSpecError); + moduleSpecFromFile(std::ifstream& in, const bool check = true); } } #endif // _DATA_DEF_H -// Local Variables: +// Local Variables: // mode: c++ -// End: +// End: diff --git a/src/lib/dhcpsrv/cfg_option.cc b/src/lib/dhcpsrv/cfg_option.cc index 5d6c153918..3cd05dec40 100644 --- a/src/lib/dhcpsrv/cfg_option.cc +++ b/src/lib/dhcpsrv/cfg_option.cc @@ -4,10 +4,12 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #include -#include #include #include +#include #include #include #include @@ -169,9 +171,9 @@ CfgOption::mergeInternal(const OptionSpaceContaineroption_, - src_opt->persistent_), - *it); + dest_container.addItem(OptionDescriptor( + src_opt->option_, src_opt->persistent_, + src_opt->formatted_value_), *it); } } } @@ -276,5 +278,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/mysql_host_data_source.h b/src/lib/dhcpsrv/mysql_host_data_source.h index 11e52bd5e3..94614494ab 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 { @@ -234,9 +239,13 @@ public: /// /// This method supports v4 hosts only. /// - /// @param subnet_id subnet identifier. - /// @param addr specified address. - /// @return true if deletion was successful, false if the host was not there. + /// @param subnet_id subnet identfier + /// @param identifier_type type of host identifier (e.g. DUID, hardware + /// address) + /// @param identifier_begin pointer to the beginning of a buffer containing + /// an identifier + /// @param identifier_len host identifier length + /// @return true if deletion was successful, false if the host was not there /// @throw various exceptions in case of errors virtual bool del4(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type, @@ -246,9 +255,13 @@ public: /// /// This method supports v6 hosts only. /// - /// @param subnet_id subnet identifier. - /// @param addr specified address. - /// @return true if deletion was successful, false if the host was not there. + /// @param subnet_id subnet identfier + /// @param identifier_type type of host identifier (e.g. DUID, hardware + /// address) + /// @param identifier_begin pointer to the beginning of a buffer containing + /// an identifier + /// @param identifier_len host identifier length + /// @return true if deletion was successful, false if the host was not there /// @throw various exceptions in case of errors virtual bool del6(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type, @@ -298,7 +311,6 @@ public: virtual void rollback(); private: - /// @brief Pointer to the implementation of the @ref MySqlHostDataSource. MySqlHostDataSourceImpl* impl_; }; @@ -307,3 +319,4 @@ private: } #endif // MYSQL_HOST_DATA_SOURCE_H + diff --git a/src/lib/util/threads/tests/condvar_unittest.cc b/src/lib/util/threads/tests/condvar_unittest.cc index 40d43715e2..40013d93ff 100644 --- a/src/lib/util/threads/tests/condvar_unittest.cc +++ b/src/lib/util/threads/tests/condvar_unittest.cc @@ -134,13 +134,11 @@ signalAndWait(CondVar* condvar, Mutex* mutex) { condvar->wait(*mutex); } -TEST_F(CondVarTest, #ifdef HAS_UNDEFINED_PTHREAD_BEHAVIOR - DISABLED_destroyWhileWait +TEST_F(CondVarTest, DISABLED_destroyWhileWait) { #else - destroyWhileWait +TEST_F(CondVarTest, 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; From b7ea23d66f7c699467dbc03c51a5002368ed7188 Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Fri, 18 Aug 2017 11:40:53 +0300 Subject: [PATCH 09/11] another throw bites the dust --- src/lib/cc/data.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc index 836923a5d9..70a0b38e8a 100644 --- a/src/lib/cc/data.cc +++ b/src/lib/cc/data.cc @@ -342,7 +342,7 @@ skipTo(std::istream& in, const std::string& file, int& line, // error on the rest)? std::string strFromStringstream(std::istream& in, const std::string& file, - const int line, int& pos) throw (JSONError) + const int line, int& pos) { std::stringstream ss; int c = in.get(); From 527f970ad5a4e806128125d45036a0b3f7d25e7f Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Tue, 30 Jan 2018 16:43:16 +0200 Subject: [PATCH 10/11] minor changes --- src/lib/dhcpsrv/cql_host_data_source.cc | 2 + src/lib/dhcpsrv/cql_lease_mgr.cc | 81 ++++++++++++------------- 2 files changed, 41 insertions(+), 42 deletions(-) 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..0d51b19c0a 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; @@ -987,7 +985,8 @@ CqlLease6Exchange::createBindForInsert(const Lease6Ptr &lease, AnyArray &data) { // For convenience for external tools, this is converted to lease // expiry time (expire). The relationship is given by: // expire = cltt_ + valid_lft_ - CqlExchange::convertToDatabaseTime(lease_->cltt_, lease_->valid_lft_, expire_); + CqlExchange::convertToDatabaseTime(lease_->cltt_, lease_->valid_lft_, + expire_); // subnet_id: int subnet_id_ = static_cast(lease_->subnet_id_); @@ -1087,7 +1086,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 +1225,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 +1354,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 +1390,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 +1465,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 +1575,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 +1681,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 +1712,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 +1732,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); } From 2efa7494228a1797dff8d9d74107a452c61e2386 Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Tue, 30 Jan 2018 20:19:45 +0100 Subject: [PATCH 11/11] [github54] Merge branch 'minor-changes' of https://github.com/andreipavelQ/kea into github54 # Conflicts: # src/bin/admin/admin-utils.sh # src/lib/cc/data.h # src/lib/config/module_spec.cc # src/lib/config/module_spec.h # src/lib/cryptolink/tests/run_unittests.cc # src/lib/util/threads/tests/condvar_unittest.cc --- src/bin/dhcp4/dhcp4_messages.mes | 2 +- src/bin/dhcp6/dhcp6_messages.mes | 2 +- src/lib/dhcpsrv/cql_lease_mgr.cc | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index 6486fac74a..fef6ef62dc 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -198,7 +198,7 @@ the message. % DHCP4_DHCP4O6_RECEIVING receiving DHCPv4o6 packet from DHCPv6 server This debug message is printed when the server is receiving a DHCPv4o6 -from the DHCPv4 server over inter-process communication socket. +from the DHCPv6 server over inter-process communication socket. % DHCP4_DHCP4O6_RESPONSE_DATA %1: responding with packet %2 (type %3), packet details: %4 A debug message including the detailed data about the packet being diff --git a/src/bin/dhcp6/dhcp6_messages.mes b/src/bin/dhcp6/dhcp6_messages.mes index 9130d958b1..ff894bfa9c 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/lib/dhcpsrv/cql_lease_mgr.cc b/src/lib/dhcpsrv/cql_lease_mgr.cc index 0d51b19c0a..8f3c351b7f 100644 --- a/src/lib/dhcpsrv/cql_lease_mgr.cc +++ b/src/lib/dhcpsrv/cql_lease_mgr.cc @@ -985,8 +985,7 @@ CqlLease6Exchange::createBindForInsert(const Lease6Ptr &lease, AnyArray &data) { // For convenience for external tools, this is converted to lease // expiry time (expire). The relationship is given by: // expire = cltt_ + valid_lft_ - CqlExchange::convertToDatabaseTime(lease_->cltt_, lease_->valid_lft_, - expire_); + CqlExchange::convertToDatabaseTime(lease_->cltt_, lease_->valid_lft_, expire_); // subnet_id: int subnet_id_ = static_cast(lease_->subnet_id_);