From: Marcin Siodelski Date: Mon, 2 Sep 2013 05:58:02 +0000 (+0200) Subject: [master] Merge branch 'trac3084' X-Git-Tag: bind10-1.2.0beta1-release~233 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=79b7d8ee017b57a81cec5099bc028e1494d7e2e9;p=thirdparty%2Fkea.git [master] Merge branch 'trac3084' --- 79b7d8ee017b57a81cec5099bc028e1494d7e2e9 diff --cc src/lib/dhcpsrv/lease_mgr.cc index c4810fd5f9,54e97b2af2..c8fac3178d --- a/src/lib/dhcpsrv/lease_mgr.cc +++ b/src/lib/dhcpsrv/lease_mgr.cc @@@ -33,57 -33,14 +33,58 @@@ namespace isc 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) { } +Lease4::Lease4(const Lease4& other) + : Lease(other.addr_, other.t1_, other.t2_, other.valid_lft_, - other.subnet_id_, other.cltt_), ext_(other.ext_), ++ other.subnet_id_, other.cltt_, other.fqdn_fwd_, ++ other.fqdn_rev_, other.hostname_), ext_(other.ext_), + hwaddr_(other.hwaddr_) { + + fixed_ = other.fixed_; - fqdn_fwd_ = other.fqdn_fwd_; - fqdn_rev_ = other.fqdn_rev_; - hostname_ = other.hostname_; + 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) diff --cc src/lib/dhcpsrv/lease_mgr.h index 3e0e092682,1afb6353bb..051f4858e4 --- a/src/lib/dhcpsrv/lease_mgr.h +++ b/src/lib/dhcpsrv/lease_mgr.h @@@ -256,19 -267,9 +267,19 @@@ struct Lease4 : public Lease /// @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