static constexpr StatementTag DELETE_LEASE6 = "DELETE_LEASE6";
static constexpr StatementTag GET_LEASE6_EXPIRE = "GET_LEASE6_EXPIRE";
static constexpr StatementTag GET_LEASE6_ADDR = "GET_LEASE6_ADDR";
- static constexpr StatementTag GET_LEASE6_DUID = "GET_LEASE6_DUID";
static constexpr StatementTag GET_LEASE6_DUID_IAID = "GET_LEASE6_DUID_IAID";
static constexpr StatementTag GET_LEASE6_DUID_IAID_SUBID = "GET_LEASE6_DUID_IAID_SUBID";
static constexpr StatementTag GET_LEASE6_LIMIT = "GET_LEASE6_LIMIT";
constexpr StatementTag CqlLease6Exchange::DELETE_LEASE6;
constexpr StatementTag CqlLease6Exchange::GET_LEASE6_EXPIRE;
constexpr StatementTag CqlLease6Exchange::GET_LEASE6_ADDR;
-constexpr StatementTag CqlLease6Exchange::GET_LEASE6_DUID;
constexpr StatementTag CqlLease6Exchange::GET_LEASE6_DUID_IAID;
constexpr StatementTag CqlLease6Exchange::GET_LEASE6_DUID_IAID_SUBID;
constexpr StatementTag CqlLease6Exchange::GET_LEASE6_LIMIT;
"AND lease_type = ? "
"ALLOW FILTERING "}},
- // Gets an IPv6 lease with specified duid
- {GET_LEASE6_DUID,
- {GET_LEASE6_DUID,
- "SELECT "
- "address, valid_lifetime, expire, subnet_id, pref_lifetime, duid, iaid, "
- "lease_type, prefix_len, fqdn_fwd, fqdn_rev, hostname, hwaddr, hwtype, "
- "hwaddr_source, state "
- "FROM lease6 "
- "WHERE duid = ? "
- "ALLOW FILTERING "}},
-
// Gets an IPv6 lease(s) with specified duid and iaid
{GET_LEASE6_DUID_IAID,
{GET_LEASE6_DUID_IAID,
return (result);
}
-Lease6Collection
-CqlLeaseMgr::getLeases6(const DUID& duid) const {
-
- // Set up the WHERE clause value
- AnyArray data;
-
- CassBlob duid_data(duid.getDuid());
-
- data.add(&duid_data);
-
- // Get the data.
- Lease6Collection result;
- std::unique_ptr<CqlLease6Exchange> exchange6(new CqlLease6Exchange(dbconn_));
- exchange6->getLeaseCollection(CqlLease6Exchange::GET_LEASE6_DUID, data, result);
-
- return (result);
-
-}
-
Lease6Collection
CqlLeaseMgr::getLeases6(Lease::Type lease_type, const DUID &duid, uint32_t iaid) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_CQL_GET_IAID_DUID)
getLeases6(const asiolink::IOAddress& lower_bound_address,
const LeasePageSize& page_size) const override;
- /// @brief Returns all IPv6 leases.
- ///
- /// @return Lease collection (may be empty if no IPv6 lease found).
- virtual Lease6Collection getLeases6(const DUID& duid) const;
-
/// @brief Returns a collection of expired DHCPv4 leases.
///
/// This method returns at most @c max_leases expired leases. The leases
virtual Lease6Collection
getLeases6(const asiolink::IOAddress& lower_bound_address,
const LeasePageSize& page_size) const = 0;
-
- /// @brief Returns collection of lease for matching DUID
- ///
- /// @return Lease collection (may be empty if no IPv6 lease found for the DUID).
- virtual Lease6Collection getLeases6(const DUID& duid) const = 0;
/// @brief Returns a collection of expired DHCPv4 leases.
///
return (collection);
}
-Lease6Collection
-Memfile_LeaseMgr::getLeases6(const DUID& duid) const {
- LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MEMFILE_GET6_DUID)
- .arg(duid.toText());
-
- Lease6Collection collection;
- for (auto lease = storage6_.begin(); lease != storage6_.end(); ++lease ) {
- if ( (**lease).duid_->getDuid() == duid.getDuid() )
- collection.push_back(Lease6Ptr(new Lease6(**lease)));
- }
-
- return (collection);
-}
-
Lease6Collection
Memfile_LeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
const LeasePageSize& page_size) const {
///
/// @return Lease collection (may be empty if no IPv6 lease found).
virtual Lease6Collection getLeases6() const;
-
- /// @brief Returns IPv6 leases for the DUID.
- ///
- /// @todo: implement an optimised of the query using index.
- /// @return Lease collection (may be empty if no IPv6 lease found) for the DUID.
- virtual Lease6Collection getLeases6(const DUID& duid) const;
/// @brief Returns range of IPv6 leases using paging.
///
///
/// @return Lease collection (may be empty if no IPv6 lease found).
virtual Lease6Collection getLeases6() const;
-
- /// @brief Returns all IPv6 leases for the DUID.
- ///
- /// @todo: implement an optimised of the query using index.
- /// @return Lease collection (may be empty if no IPv6 lease found) for the DUID.
- virtual Lease6Collection getLeases6(const DUID& duid) const;
/// @brief Returns range of IPv6 leases using paging.
///
return (result);
}
-Lease6Collection
-PgSqlLeaseMgr::getLeases6( const DUID& duid ) const {
- LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
- DHCPSRV_PGSQL_GET_DUID)
- .arg(duid.toText());
-
- Lease6Collection result = getLeases6();
-
- //erase the ones not containing the matching DUID
- for (auto iter = result.begin(); iter != result.end();
- iter++) {
- if ((*iter)->duid_->getDuid() != duid.getDuid()) {
- result.erase(iter);
- }
- }
-
- return (result);
-}
-
Lease6Collection
PgSqlLeaseMgr::getLeases6() const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET6);
///
/// @return Lease collection (may be empty if no IPv6 lease found).
virtual Lease6Collection getLeases6() const;
-
- /// @brief Returns IPv6 leases for the DUID.
- ///
- /// @todo: implement an optimised of the query using index.
- /// @return Lease collection (may be empty if no IPv6 lease found) for the DUID
- virtual Lease6Collection getLeases6(const DUID& duid) const;
/// @brief Returns range of IPv6 leases using paging.
///
getLeases6(const asiolink::IOAddress& lower_bound_address,
const LeasePageSize& page_size) const;
- /// @brief Returns all IPv6 leases.
- ///
- /// @return Lease collection (may be empty if no IPv6 lease found).
- virtual Lease6Collection getLeases6(const DUID& duid) const;
-
/// @brief Returns a collection of expired DHCPv4 leases.
///
/// This method returns at most @c max_leases expired leases. The leases