From: Francis Dupont Date: Mon, 4 Jul 2016 11:13:59 +0000 (+0200) Subject: [4321] Cosmetics changes (no real code change) X-Git-Tag: trac4551_base~29^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b239ccf3607fdd06281a0e5a6b5735da13bbc95d;p=thirdparty%2Fkea.git [4321] Cosmetics changes (no real code change) --- diff --git a/src/bin/dhcp6/tests/dhcp6_client.cc b/src/bin/dhcp6/tests/dhcp6_client.cc index fb8be12f49..43d4a7a47f 100644 --- a/src/bin/dhcp6/tests/dhcp6_client.cc +++ b/src/bin/dhcp6/tests/dhcp6_client.cc @@ -55,7 +55,7 @@ struct getLeasesByPropertyFun { for (typename std::vector::const_iterator lease = config.leases_.begin(); lease != config.leases_.end(); ++lease) { - // Check if fulfils the condition. + // Check if fulfills the condition. if ((equals && ((*lease).*MemberPointer) == property) || (!equals && ((*lease).*MemberPointer) != property)) { // Found the matching lease. @@ -252,15 +252,18 @@ Dhcp6Client::appendFQDN() { void Dhcp6Client::appendRequestedIAs(const Pkt6Ptr& query) const { BOOST_FOREACH(const ClientIA& ia, client_ias_) { - OptionCollection options = query->getOptions(ia.type_ == Lease::TYPE_NA ? - D6O_IA_NA : D6O_IA_PD); + OptionCollection options = + query->getOptions(ia.type_ == Lease::TYPE_NA ? + D6O_IA_NA : D6O_IA_PD); std::pair option_pair; Option6IAPtr existing_ia; BOOST_FOREACH(option_pair, options) { - Option6IAPtr ia_opt = boost::dynamic_pointer_cast(option_pair.second); + Option6IAPtr ia_opt = + boost::dynamic_pointer_cast(option_pair.second); // This shouldn't happen. if (!ia_opt) { - isc_throw(Unexpected, "Dhcp6Client: IA option has an invalid C++ type;" + isc_throw(Unexpected, + "Dhcp6Client: IA option has an invalid C++ type;" " this is a programming issue"); } if (ia_opt->getIAID() == ia.iaid_) { @@ -280,7 +283,8 @@ Dhcp6Client::appendRequestedIAs(const Pkt6Ptr& query) const { BOOST_FOREACH(option_pair, existing_ia->getOptions()) { Option6IAAddrPtr existing_addr = boost::dynamic_pointer_cast< Option6IAAddr>(option_pair.second); - if (existing_addr && (existing_addr->getAddress() == ia.prefix_)) { + if (existing_addr && + (existing_addr->getAddress() == ia.prefix_)) { option_exists = true; } } @@ -289,15 +293,17 @@ Dhcp6Client::appendRequestedIAs(const Pkt6Ptr& query) const { existing_ia->addOption(ia_addr); } - } else if ((ia.type_ == Lease::TYPE_PD) && (!ia.prefix_.isV6Zero() || - (ia.prefix_len_ > 0))) { - Option6IAPrefixPtr ia_prefix(new Option6IAPrefix(D6O_IAPREFIX, ia.prefix_, + } else if ((ia.type_ == Lease::TYPE_PD) && + (!ia.prefix_.isV6Zero() || (ia.prefix_len_ > 0))) { + Option6IAPrefixPtr ia_prefix(new Option6IAPrefix(D6O_IAPREFIX, + ia.prefix_, ia.prefix_len_, 0, 0)); BOOST_FOREACH(option_pair, existing_ia->getOptions()) { - Option6IAPrefixPtr existing_prefix = boost::dynamic_pointer_cast< - Option6IAPrefix>(option_pair.second); - if (existing_prefix && (existing_prefix->getAddress() == ia.prefix_) && + Option6IAPrefixPtr existing_prefix = + boost::dynamic_pointer_cast(option_pair.second); + if (existing_prefix && + (existing_prefix->getAddress() == ia.prefix_) && existing_prefix->getLength()) { option_exists = true; } @@ -435,8 +441,10 @@ Dhcp6Client::doSolicit(const bool always_apply_config) { // If using Rapid Commit and the server has responded with Reply, // let's apply received configuration. We also apply the configuration // for the Advertise if instructed to do so. - if (context_.response_ && (always_apply_config || (use_rapid_commit_ && - context_.response_->getType() == DHCPV6_REPLY))) { + if (context_.response_ && + (always_apply_config || + (use_rapid_commit_ && + context_.response_->getType() == DHCPV6_REPLY))) { config_.clear(); applyRcvdConfiguration(context_.response_); } diff --git a/src/bin/dhcp6/tests/dhcp6_client.h b/src/bin/dhcp6/tests/dhcp6_client.h index 7cb615480d..1c526e4b60 100644 --- a/src/bin/dhcp6/tests/dhcp6_client.h +++ b/src/bin/dhcp6/tests/dhcp6_client.h @@ -298,7 +298,7 @@ public: /// /// This function generates Information-request message, sends it /// to the server and then receives the reply. Contents of the Inf-Request - /// are controlled by use_na_, use_pd_, use_client_id_ and use_oro_ + /// are controlled by client_ias_, use_client_id_ and use_oro_ /// fields. This method does not process the response in any specific /// way, just stores it. void doInfRequest(); @@ -367,7 +367,8 @@ public: /// @param address Leased address. /// /// @return Vector containing leases for the specified address. - std::vector getLeasesByAddress(const asiolink::IOAddress& address) const; + std::vector + getLeasesByAddress(const asiolink::IOAddress& address) const; /// @brief Returns leases belonging to specified address range. /// @@ -375,8 +376,9 @@ public: /// @param second Upper bound of the address range. /// /// @return Vector containing leases belonging to specified address range. - std::vector getLeasesByAddressRange(const asiolink::IOAddress& first, - const asiolink::IOAddress& second) const; + std::vector + getLeasesByAddressRange(const asiolink::IOAddress& first, + const asiolink::IOAddress& second) const; /// @brief Returns leases belonging to prefix pool. /// @@ -385,9 +387,10 @@ public: /// @param delegated_len Delegated prefix length. /// /// @return Vector containing leases belonging to specified prefix pool. - std::vector getLeasesByPrefixPool(const asiolink::IOAddress& prefix, - const uint8_t prefix_len, - const uint8_t delegated_len) const; + std::vector + getLeasesByPrefixPool(const asiolink::IOAddress& prefix, + const uint8_t prefix_len, + const uint8_t delegated_len) const; /// @brief Checks if client has lease for the specified address. /// @@ -644,6 +647,9 @@ public: void useFQDN(const uint8_t flags, const std::string& fqdn_name, Option6ClientFqdn::DomainNameType fqdn_type); + /// @brief Controls whether the client should send an addres in IA_NA + /// + /// @param send should the address be included? void includeAddress(const bool send) { include_address_ = send; } @@ -733,7 +739,7 @@ private: /// @brief Includes IAs to be requested. /// - /// This method includes IAs explicitly requested using + /// This method includes IAs explicitly requested using client_ias_ /// /// @param query Pointer to the client's message to which IAs should be /// added. @@ -854,6 +860,10 @@ private: /// @brief FQDN requested by the client. Option6ClientFqdnPtr fqdn_; + /// @brief Determines if the client will include address in the messages + /// it sends. + /// + /// @todo this flag is currently supported in Decline only. bool include_address_; }; diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.h b/src/bin/dhcp6/tests/dhcp6_test_utils.h index f36ba41b42..42d6816e51 100644 --- a/src/bin/dhcp6/tests/dhcp6_test_utils.h +++ b/src/bin/dhcp6/tests/dhcp6_test_utils.h @@ -37,14 +37,14 @@ namespace test { /// @brief Generic wrapper to provide strongly typed values. /// /// In many cases, the test fixture class methods require providing many -/// paramaters, of which some ore optional. Some of the parameters may also +/// parameters, of which some are optional. Some of the parameters may also /// be implicitly converted to other types. Non-careful test implementer /// may often "shift by one" or swap two values on the arguments list, which /// will be accepted by the compiler but will result in troubles running the /// function. Sometimes it takes non trivial amount of debugging to find out /// why the particular function fails until we find that the arguments were /// swapped or shifted. In addition, the use of classes wrapping simple types -/// results in better readbility of the test code. +/// results in better readability of the test code. /// /// @tparam ValueType Type of the wrapped value. template diff --git a/src/bin/dhcp6/tests/host_unittest.cc b/src/bin/dhcp6/tests/host_unittest.cc index 563b1baf30..80cfea767c 100644 --- a/src/bin/dhcp6/tests/host_unittest.cc +++ b/src/bin/dhcp6/tests/host_unittest.cc @@ -116,7 +116,7 @@ const char* CONFIGS[] = { "}" }; -/// @brief Base class representing leases and hints coveyed within IAs. +/// @brief Base class representing leases and hints conveyed within IAs. /// /// This is a base class for @ref Reservation and @ref Hint classes. class IAResource { @@ -353,7 +353,7 @@ public: /// number of reservations it checks that for the remaining IAs the /// leases from dynamic pools are assigned. /// - /// The strict_iaid_check flag controlls whether the test should verify + /// The strict_iaid_check flag controls whether the test should verify /// that the address or prefix specified as a hint is assigned by the /// server to the IA in which the hint was placed by the client. /// @@ -412,7 +412,7 @@ public: /// "01:02:03:04". /// /// @param r1 Reservation 1. Default value is "unspecified" in which case - /// the reservation will not be included in the configruation. + /// the reservation will not be included in the configuration. /// @param r2 Reservation 2. /// @param r3 Reservation 3. /// @param r4 Reservation 4. @@ -841,7 +841,7 @@ TEST_F(HostTest, sarrAndRebind) { EXPECT_EQ("alice", lease_server2->hostname_); } -// This test verfies that the host reservation by DUID is found by the +// This test verifies that the host reservation by DUID is found by the // server. TEST_F(HostTest, reservationByDUID) { Dhcp6Client client; @@ -851,7 +851,7 @@ TEST_F(HostTest, reservationByDUID) { testReservationByIdentifier(client, 1, "2001:db8:1::2"); } -// This test verfies that the host reservation by HW address is found +// This test verifies that the host reservation by HW address is found // by the server. TEST_F(HostTest, reservationByHWAddress) { Dhcp6Client client; diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 2d0cf66062..596d81df5a 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -589,8 +589,8 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) { if (pool) { /// @todo: We support only one hint for now - Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(ctx.currentIA().type_, - hint); + Lease6Ptr lease = + LeaseMgrFactory::instance().getLease6(ctx.currentIA().type_, hint); if (!lease) { // In-pool reservations: Check if this address is reserved for someone diff --git a/src/lib/dhcpsrv/lease.h b/src/lib/dhcpsrv/lease.h index d318eac931..d1ab300f11 100644 --- a/src/lib/dhcpsrv/lease.h +++ b/src/lib/dhcpsrv/lease.h @@ -479,7 +479,7 @@ struct Lease6 : public Lease { /// @param fqdn_rev If true, reverse DNS update is performed for a lease. /// @param hostname FQDN of the client which gets the lease. /// @param hwaddr hardware address (MAC), may be NULL - /// @param prefixlen An address prefix length. + /// @param prefixlen An address prefix length (optional, defaults to 128) Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr, DuidPtr duid, uint32_t iaid, uint32_t preferred, uint32_t valid, uint32_t t1, uint32_t t2, SubnetID subnet_id, const bool fqdn_fwd,