for (typename std::vector<Lease6>::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.
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<unsigned int, OptionPtr> option_pair;
Option6IAPtr existing_ia;
BOOST_FOREACH(option_pair, options) {
- Option6IAPtr ia_opt = boost::dynamic_pointer_cast<Option6IA>(option_pair.second);
+ Option6IAPtr ia_opt =
+ boost::dynamic_pointer_cast<Option6IA>(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_) {
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;
}
}
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<Option6IAPrefix>(option_pair.second);
+ if (existing_prefix &&
+ (existing_prefix->getAddress() == ia.prefix_) &&
existing_prefix->getLength()) {
option_exists = true;
}
// 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_);
}
///
/// 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();
/// @param address Leased address.
///
/// @return Vector containing leases for the specified address.
- std::vector<Lease6> getLeasesByAddress(const asiolink::IOAddress& address) const;
+ std::vector<Lease6>
+ getLeasesByAddress(const asiolink::IOAddress& address) const;
/// @brief Returns leases belonging to specified address range.
///
/// @param second Upper bound of the address range.
///
/// @return Vector containing leases belonging to specified address range.
- std::vector<Lease6> getLeasesByAddressRange(const asiolink::IOAddress& first,
- const asiolink::IOAddress& second) const;
+ std::vector<Lease6>
+ getLeasesByAddressRange(const asiolink::IOAddress& first,
+ const asiolink::IOAddress& second) const;
/// @brief Returns leases belonging to prefix pool.
///
/// @param delegated_len Delegated prefix length.
///
/// @return Vector containing leases belonging to specified prefix pool.
- std::vector<Lease6> getLeasesByPrefixPool(const asiolink::IOAddress& prefix,
- const uint8_t prefix_len,
- const uint8_t delegated_len) const;
+ std::vector<Lease6>
+ 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.
///
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;
}
/// @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.
/// @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_;
};
/// @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<typename ValueType>
"}"
};
-/// @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 {
/// 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.
///
/// "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.
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;
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;
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
/// @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,