]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Merge branch 'trac2940'
authorMarcin Siodelski <marcin@isc.org>
Fri, 22 Nov 2013 08:30:36 +0000 (09:30 +0100)
committerMarcin Siodelski <marcin@isc.org>
Fri, 22 Nov 2013 08:30:36 +0000 (09:30 +0100)
Conflicts:
src/lib/dhcpsrv/lease.cc
src/lib/dhcpsrv/lease.h

1  2 
src/lib/dhcpsrv/lease.cc
src/lib/dhcpsrv/lease.h
src/lib/dhcpsrv/tests/lease_mgr_unittest.cc

index 2e4bf2e4eb8f0d527901cbfb9b133f92c759433f,a9e3d4bfc463a969f950ece67135ac8aef09fcfd..4ca6a3ce0b1f8361383ce1c8d9a375a925685e84
@@@ -74,26 -74,16 +74,36 @@@ Lease4::Lease4(const Lease4& other
      }
  }
  
+ const std::vector<uint8_t>&
+ Lease4::getClientIdVector() const {
+     if(!client_id_) {
+         static std::vector<uint8_t> empty_vec;
+         return (empty_vec);
+     }
+     return (client_id_->getClientId());
+ }
 +bool
 +Lease4::matches(const Lease4& other) const {
 +    if ((client_id_ && !other.client_id_) ||
 +        (!client_id_ && other.client_id_)) {
 +        // One lease has client-id, but the other doesn't
 +        return false;
 +    }
 +
 +    if (client_id_ && other.client_id_ &&
 +        *client_id_ != *other.client_id_) {
 +        // Different client-ids
 +        return false;
 +    }
 +
 +    return (addr_ == other.addr_ &&
 +            ext_ == other.ext_ &&
 +            hwaddr_ == other.hwaddr_);
 +
 +}
 +
  Lease4&
  Lease4::operator=(const Lease4& other) {
      if (this != &other) {
index 0f0cb3cec62cfd8389d8d0c455b9106f2f792c0e,1bf6796fb2c5aa58b165fc1276d2ab6b921ce2fe..86266205c9d1b61011bbb70f60a7c5890031ad6f
@@@ -209,20 -209,17 +209,31 @@@ struct Lease4 : public Lease 
      /// @param other the @c Lease4 object to be copied.
      Lease4(const Lease4& other);
  
+     /// @brief Returns a client identifier.
+     ///
+     /// @warning Since the function returns the reference to a vector (not a
+     /// copy), the returned object should be used with caution because it will
+     /// remain valid only for the period of time when an object which returned
+     /// it exists.
+     ///
+     /// @return A reference to a vector holding client identifier,
+     /// or an empty vector if client identifier is NULL.
+     const std::vector<uint8_t>& getClientIdVector() const;
 +    /// @brief Check if two objects encapsulate the lease for the same
 +    /// client.
 +    ///
 +    /// Checks if two @c Lease4 objects have the same address, client id,
 +    /// HW address and ext_ value.  If these parameters match it is an
 +    /// indication that both objects describe the lease for the same
 +    /// client but apparently one is a result of renewal of the other. The
 +    /// special case of the matching lease is the one that is equal to another.
 +    ///
 +    /// @param other A lease to compare with.
 +    ///
 +    /// @return true if the selected parameters of the two leases match.
 +    bool matches(const Lease4& other) const;
 +
      /// @brief Assignment operator.
      ///
      /// @param other the @c Lease4 object to be assigned.
@@@ -334,20 -331,16 +345,30 @@@ struct Lease6 : public Lease 
          type_(TYPE_NA) {
      }
  
+     /// @brief Returns a reference to a vector representing a DUID.
+     ///
+     /// @warning Since the function returns the reference to a vector (not a
+     /// copy), the returned object should be used with caution because it will
+     /// remain valid only for the period of time when an object which returned
+     /// it exists.
+     ///
+     /// @return A reference to a vector holding a DUID.
+     const std::vector<uint8_t>& getDuidVector() const;
 +    /// @brief Checks if two lease objects encapsulate the lease for the same
 +    /// client.
 +    ///
 +    /// This function compares address, type, prefix length, IAID and DUID
 +    /// parameters between two @c Lease6 objects. If these parameters match
 +    /// it is an indication that both objects describe the lease for the same
 +    /// client but apparently one is a result of renewal of the other. The
 +    /// special case of the matching lease is the one that is equal to another.
 +    ///
 +    /// @param other A lease to compare to.
 +    ///
 +    /// @return true if selected parameters of the two leases match.
 +    bool matches(const Lease6& other) const;
 +
      /// @brief Compare two leases for equality
      ///
      /// @param other lease6 object with which to compare