7 #ifndef MYSQL_LEASE_MGR_H 8 #define MYSQL_LEASE_MGR_H 15 #include <boost/scoped_ptr.hpp> 16 #include <boost/utility.hpp> 26 class MySqlLease4Exchange;
27 class MySqlLease6Exchange;
280 uint32_t iaid)
const;
299 uint32_t iaid,
SubnetID subnet_id)
const;
359 const size_t max_leases)
const;
372 const size_t max_leases)
const;
521 return (std::string(
"mysql"));
529 virtual std::string
getName()
const;
550 virtual std::pair<uint32_t, uint32_t>
getVersion()
const;
622 bool addLeaseCommon(
StatementIndex stindex, std::vector<MYSQL_BIND>& bind);
644 template <
typename Exchange,
typename LeaseCollection>
646 Exchange& exchange, LeaseCollection& result,
647 bool single =
false)
const;
667 getLeaseCollection(stindex, bind, exchange4_, result);
687 getLeaseCollection(stindex, bind, exchange6_, result);
729 template<
typename LeaseCollection>
730 void getExpiredLeasesCommon(LeaseCollection& expired_leases,
731 const size_t max_leases,
750 template <
typename LeasePtr>
769 uint64_t deleteLeaseCommon(
StatementIndex stindex, MYSQL_BIND* bind);
780 uint64_t deleteExpiredReclaimedLeasesCommon(
const uint32_t secs,
794 const char* what)
const;
802 boost::scoped_ptr<MySqlLease4Exchange> exchange4_;
803 boost::scoped_ptr<MySqlLease6Exchange> exchange6_;
806 db::MySqlConnection conn_;
812 #endif // MYSQL_LEASE_MGR_H
virtual std::pair< uint32_t, uint32_t > getVersion() const
Returns backend version.
boost::shared_ptr< LeaseStatsQuery > LeaseStatsQueryPtr
Defines a pointer to a LeaseStatsQuery.
static std::string getDBVersion()
Local version of getDBVersion() class method.
virtual uint64_t deleteExpiredReclaimedLeases6(const uint32_t secs)
Deletes all expired-reclaimed DHCPv6 leases.
virtual Lease4Ptr getLease4(const isc::asiolink::IOAddress &addr) const
Returns an IPv4 lease for specified IPv4 address.
An abstract API for lease database.
virtual void getExpiredLeases4(Lease4Collection &expired_leases, const size_t max_leases) const
Returns a collection of expired DHCPv4 leases.
virtual size_t wipeLeases6(const SubnetID &subnet_id)
Removed specified IPv6 leases.
std::vector< Lease4Ptr > Lease4Collection
A collection of IPv4 leases.
virtual Lease6Ptr getLease6(Lease::Type type, const isc::asiolink::IOAddress &addr) const
Returns existing IPv6 lease for a given IPv6 address.
virtual void updateLease6(const Lease6Ptr &lease6)
Updates IPv6 lease.
virtual LeaseStatsQueryPtr startLeaseStatsQuery4()
Creates and runs the IPv4 lease stats query.
virtual size_t wipeLeases4(const SubnetID &subnet_id)
Removes specified IPv4 leases.
virtual Lease6Collection getLeases6() const
Returns all IPv6 leases.
boost::shared_ptr< Lease > LeasePtr
Pointer to the lease object.
Holds DUID (DHCPv6 Unique Identifier)
virtual uint64_t deleteExpiredReclaimedLeases4(const uint32_t secs)
Deletes all expired-reclaimed DHCPv4 leases.
virtual void rollback()
Rollback Transactions.
virtual bool addLease(const Lease4Ptr &lease)
Adds an IPv4 lease.
virtual LeaseStatsQueryPtr startSubnetLeaseStatsQuery6(const SubnetID &subnet_id)
Creates and runs the IPv6 lease stats query for a single subnet.
StatementIndex
Statement Tags.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
virtual std::string getDescription() const
Returns description of the backend.
virtual Lease4Collection getLeases4() const
Returns all IPv4 leases.
virtual ~MySqlLeaseMgr()
Destructor (closes database)
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
virtual void updateLease4(const Lease4Ptr &lease4)
Updates IPv4 lease.
virtual LeaseStatsQueryPtr startSubnetRangeLeaseStatsQuery6(const SubnetID &first_subnet_id, const SubnetID &last_subnet_id)
Creates and runs the IPv6 lease stats query for a single subnet.
virtual LeaseStatsQueryPtr startSubnetLeaseStatsQuery4(const SubnetID &subnet_id)
Creates and runs the IPv4 lease stats query for a single subnet.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Type
Type of lease or pool.
Holds Client identifier or client IPv4 address.
virtual LeaseStatsQueryPtr startSubnetRangeLeaseStatsQuery4(const SubnetID &first_subnet_id, const SubnetID &last_subnet_id)
Creates and runs the IPv4 lease stats query for a single subnet.
Hardware type that represents information from DHCPv4 packet.
virtual LeaseStatsQueryPtr startLeaseStatsQuery6()
Creates and runs the IPv6 lease stats query.
Wraps value holding size of the page with leases.
virtual std::string getType() const
Return backend type.
virtual std::string getName() const
Returns backend name.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
The IOAddress class represents an IP addresses (version agnostic)
virtual bool deleteLease(const isc::asiolink::IOAddress &addr)
Deletes a lease.
virtual void getExpiredLeases6(Lease6Collection &expired_leases, const size_t max_leases) const
Returns a collection of expired DHCPv6 leases.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
virtual void commit()
Commit Transactions.
MySqlLeaseMgr(const db::DatabaseConnection::ParameterMap ¶meters)
Constructor.
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)