/// @brief IAID used for IA_NA.
uint32_t na_iaid_;
-
};
};
ASSERT_TRUE(declined_global);
uint64_t before_global = declined_cnt->getInteger().first;
+ /// Determines if the client will include address in the messages it sends.
+ bool include_address_ = true;
+
// Let's tamper with the address if necessary.
switch (addr_type) {
case VALID_ADDR:
break;
case NO_ADDR:
// Tell the client to not include an address in its IA_NA
- client.includeAddress(false);
+ include_address_ = false;
break;
case NO_IA:
// Tell the client to not include IA_NA at all
client.config_.leases_[0].iaid_ = iaid2;
// Ok, let's decline the lease.
- ASSERT_NO_THROW(client.doDecline());
+ ASSERT_NO_THROW(client.doDecline(include_address_));
// Let's check if there's a lease
Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA,
use_client_id_(true),
use_rapid_commit_(false),
client_ias_(),
- fqdn_(),
- include_address_(true) {
+ fqdn_() {
}
Dhcp6Client::Dhcp6Client(boost::shared_ptr<NakedDhcpv6Srv>& srv) :
use_client_id_(true),
use_rapid_commit_(false),
client_ias_(),
- fqdn_(),
- include_address_(true) {
+ fqdn_() {
}
void
}
void
-Dhcp6Client::doDecline() {
+Dhcp6Client::doDecline(const bool include_address) {
Pkt6Ptr query = createMsg(DHCPV6_DECLINE);
if (!forced_server_id_) {
query->addOption(context_.response_->getOption(D6O_SERVERID));
query->addOption(forced_server_id_);
}
- generateIAFromLeases(query);
+ generateIAFromLeases(query, include_address);
context_.query_ = query;
sendMsg(context_.query_);
}
void
-Dhcp6Client::generateIAFromLeases(const Pkt6Ptr& query) {
+Dhcp6Client::generateIAFromLeases(const Pkt6Ptr& query,
+ const bool include_address) {
/// @todo: add support for IAPREFIX here.
for (std::vector<Lease6>::const_iterator lease = config_.leases_.begin();
Option6IAPtr ia(new Option6IA(D6O_IA_NA, lease->iaid_));
- if (include_address_) {
+ if (include_address) {
ia->addOption(OptionPtr(new Option6IAAddr(D6O_IAADDR,
lease->addr_, lease->preferred_lft_, lease->valid_lft_)));
}
///
/// This function simulates sending the Decline message to the server and
/// receiving the server's response.
- void doDecline();
+ /// @param include_address should the address be included?
+ void doDecline(const bool include_address = true);
/// @brief Performs stateless (inf-request / reply) exchange.
///
const asiolink::IOAddress& prefix =
asiolink::IOAddress::IPV6_ZERO_ADDRESS());
- /// @brief Removes IAs specified with @ref includeAddress and
- /// @ref includePrefix methods.
+ /// @brief Removes IAs specified by @ref requestAddress and
+ /// @ref requestPrefix methods.
///
/// If this method is called and the client initiates an exchange with
/// a server the client will only include IAs for which it has leases.
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 Lease configuration obtained by the client.
Configuration config_;
/// @brief Generates IA_NA based on lease information
///
/// @param query generated IA_NA options will be added here
- void
- generateIAFromLeases(const Pkt6Ptr& query);
+ /// @param include_address should the address be included?
+ void generateIAFromLeases(const Pkt6Ptr& query,
+ const bool include_address = true);
/// @brief Adds extra option (an option the client will always send)
///
/// @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_;
};
} // end of namespace isc::dhcp::test