namespace dhcp {
Lease::Lease(const isc::asiolink::IOAddress& addr, uint32_t t1, uint32_t t2,
- uint32_t valid_lft, SubnetID subnet_id, time_t cltt)
+ uint32_t valid_lft, SubnetID subnet_id, time_t cltt,
+ const bool fqdn_fwd, const bool fqdn_rev,
+ const std::string& hostname)
:addr_(addr), t1_(t1), t2_(t2), valid_lft_(valid_lft), cltt_(cltt),
- subnet_id_(subnet_id), fixed_(false), fqdn_fwd_(false), fqdn_rev_(false) {
+ subnet_id_(subnet_id), fixed_(false), hostname_(hostname),
+ fqdn_fwd_(fqdn_fwd), fqdn_rev_(fqdn_rev) {
}
- other.subnet_id_, other.cltt_), ext_(other.ext_),
+Lease4::Lease4(const Lease4& other)
+ : Lease(other.addr_, other.t1_, other.t2_, other.valid_lft_,
- fqdn_fwd_ = other.fqdn_fwd_;
- fqdn_rev_ = other.fqdn_rev_;
- hostname_ = other.hostname_;
++ other.subnet_id_, other.cltt_, other.fqdn_fwd_,
++ other.fqdn_rev_, other.hostname_), ext_(other.ext_),
+ hwaddr_(other.hwaddr_) {
+
+ fixed_ = other.fixed_;
+ comments_ = other.comments_;
+
+ if (other.client_id_) {
+ client_id_.reset(new ClientId(other.client_id_->getClientId()));
+
+ } else {
+ client_id_.reset();
+
+ }
+}
+
+Lease4&
+Lease4::operator=(const Lease4& other) {
+ if (this != &other) {
+ addr_ = other.addr_;
+ t1_ = other.t1_;
+ t2_ = other.t2_;
+ valid_lft_ = other.valid_lft_;
+ cltt_ = other.cltt_;
+ subnet_id_ = other.subnet_id_;
+ fixed_ = other.fixed_;
+ hostname_ = other.hostname_;
+ fqdn_fwd_ = other.fqdn_fwd_;
+ fqdn_rev_ = other.fqdn_rev_;
+ comments_ = other.comments_;
+ ext_ = other.ext_;
+ hwaddr_ = other.hwaddr_;
+
+ if (other.client_id_) {
+ client_id_.reset(new ClientId(other.client_id_->getClientId()));
+ } else {
+ client_id_.reset();
+ }
+ }
+ return (*this);
+}
+
Lease6::Lease6(LeaseType 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, uint8_t prefixlen)
/// @brief Default constructor
///
/// Initialize fields that don't have a default constructor.
- Lease4() : Lease(0, 0, 0, 0, 0, 0) {
+ Lease4() : Lease(0, 0, 0, 0, 0, 0, false, false, "") {
}
+ /// @brief Copy constructor
+ ///
+ /// @param other the @c Lease4 object to be copied.
+ Lease4(const Lease4& other);
+
+ /// @brief Assignment operator.
+ ///
+ /// @param other the @c Lease4 object to be assigned.
+ Lease4& operator=(const Lease4& other);
+
/// @brief Compare two leases for equality
///
/// @param other lease6 object with which to compare