]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Merge branch 'trac3084'
authorMarcin Siodelski <marcin@isc.org>
Mon, 2 Sep 2013 05:58:02 +0000 (07:58 +0200)
committerMarcin Siodelski <marcin@isc.org>
Mon, 2 Sep 2013 05:58:02 +0000 (07:58 +0200)
1  2 
src/lib/dhcpsrv/lease_mgr.cc
src/lib/dhcpsrv/lease_mgr.h
src/lib/dhcpsrv/tests/lease_mgr_unittest.cc

index c4810fd5f9e197aa49832fa2605aece0fe8eaf5b,54e97b2af20d0325d23952b94a9f7a2532786797..c8fac3178d25c458535f4f2fe8eab9cd742136ab
@@@ -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) {
  }
  
-             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)
index 3e0e09268219becb25ff5fee1938b7a84eb35378,1afb6353bbd57dc1916e06cb47fe2ca4f87b44d5..051f4858e4b6d0ba47d2b9f4ab505a7ce9cedb85
@@@ -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