Kea  2.3.4-git
memfile_lease_mgr.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2022 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef MEMFILE_LEASE_MGR_H
8 #define MEMFILE_LEASE_MGR_H
9 
11 #include <asiolink/process_spawn.h>
13 #include <dhcp/hwaddr.h>
18 #include <dhcpsrv/lease_mgr.h>
19 
20 #include <boost/scoped_ptr.hpp>
21 #include <boost/shared_ptr.hpp>
22 
23 #include <mutex>
24 
25 namespace isc {
26 namespace dhcp {
27 
28 class LFCSetup;
29 
80 class Memfile_LeaseMgr : public LeaseMgr {
81 public:
82 
92  static const int MAJOR_VERSION_V4 = 2;
93 
95  static const int MINOR_VERSION_V4 = 1;
97 
109  static const int MAJOR_VERSION_V6 = 4;
110 
112  static const int MINOR_VERSION_V6 = 0;
114 
115 
122  enum Universe {
123  V4,
125  };
126 
130 
131 
153 
155  virtual ~Memfile_LeaseMgr();
156 
158  static std::string getDBVersion(Universe const& u);
159 
165  virtual bool addLease(const Lease4Ptr& lease) override;
166 
172  virtual bool addLease(const Lease6Ptr& lease) override;
173 
182  virtual Lease4Ptr getLease4(const isc::asiolink::IOAddress& addr) const override;
183 
194  virtual Lease4Collection getLease4(const isc::dhcp::HWAddr& hwaddr) const override;
195 
209  virtual Lease4Ptr getLease4(const HWAddr& hwaddr,
210  SubnetID subnet_id) const override;
211 
217  virtual Lease4Collection getLease4(const ClientId& client_id) const override;
218 
231  virtual Lease4Ptr getLease4(const ClientId& clientid,
232  SubnetID subnet_id) const override;
233 
239  virtual Lease4Collection getLeases4(SubnetID subnet_id) const override;
240 
246  virtual Lease4Collection getLeases4(const std::string& hostname) const override;
247 
251  virtual Lease4Collection getLeases4() const override;
252 
277  virtual Lease4Collection
278  getLeases4(const asiolink::IOAddress& lower_bound_address,
279  const LeasePageSize& page_size) const override;
280 
290  virtual Lease6Ptr getLease6(Lease::Type type,
291  const isc::asiolink::IOAddress& addr) const override;
292 
302  const DUID& duid,
303  uint32_t iaid) const override;
304 
318  const DUID& duid,
319  uint32_t iaid,
320  SubnetID subnet_id) const override;
321 
327  virtual Lease6Collection getLeases6(SubnetID subnet_id) const override;
328 
334  virtual Lease6Collection getLeases6(const std::string& hostname) const override;
335 
339  virtual Lease6Collection getLeases6() const override;
340 
344  virtual Lease6Collection getLeases6(const DUID& duid) const override;
345 
370  virtual Lease6Collection
371  getLeases6(const asiolink::IOAddress& lower_bound_address,
372  const LeasePageSize& page_size) const override;
373 
384  virtual void getExpiredLeases4(Lease4Collection& expired_leases,
385  const size_t max_leases) const override;
386 
397  virtual void getExpiredLeases6(Lease6Collection& expired_leases,
398  const size_t max_leases) const override;
399 
417  virtual void updateLease4(const Lease4Ptr& lease4) override;
418 
436  virtual void updateLease6(const Lease6Ptr& lease6) override;
437 
452  virtual bool deleteLease(const Lease4Ptr& lease) override;
453 
468  virtual bool deleteLease(const Lease6Ptr& lease) override;
469 
477  virtual uint64_t deleteExpiredReclaimedLeases4(const uint32_t secs) override;
478 
486  virtual uint64_t deleteExpiredReclaimedLeases6(const uint32_t secs) override;
487 
496  virtual size_t wipeLeases4(const SubnetID& subnet_id) override;
497 
506  virtual size_t wipeLeases6(const SubnetID& subnet_id) override;
507 
519  virtual std::string
520  checkLimits4(isc::data::ConstElementPtr const& user_context) const override;
521 
533  virtual std::string
534  checkLimits6(isc::data::ConstElementPtr const& user_context) const override;
535 
540  virtual bool isJsonSupported() const override;
541 
542 private:
543 
547 
553  bool addLeaseInternal(const Lease4Ptr& lease);
554 
560  bool addLeaseInternal(const Lease6Ptr& lease);
561 
567  Lease4Ptr getLease4Internal(const isc::asiolink::IOAddress& addr) const;
568 
573  void getLease4Internal(const isc::dhcp::HWAddr& hwaddr,
574  Lease4Collection& collection) const;
575 
583  Lease4Ptr getLease4Internal(const HWAddr& hwaddr,
584  SubnetID subnet_id) const;
585 
590  void getLease4Internal(const ClientId& client_id,
591  Lease4Collection& collection) const;
592 
600  Lease4Ptr getLease4Internal(const ClientId& clientid,
601  const HWAddr& hwaddr,
602  SubnetID subnet_id) const;
603 
610  Lease4Ptr getLease4Internal(const ClientId& clientid,
611  SubnetID subnet_id) const;
612 
617  void getLeases4Internal(SubnetID subnet_id,
618  Lease4Collection& collection) const;
619 
624  void getLeases4Internal(const std::string& hostname,
625  Lease4Collection& collection) const;
626 
630  void getLeases4Internal(Lease4Collection& collection) const;
631 
638  void getLeases4Internal(const asiolink::IOAddress& lower_bound_address,
639  const LeasePageSize& page_size,
640  Lease4Collection& collection) const;
641 
648  Lease6Ptr getLease6Internal(Lease::Type type,
649  const isc::asiolink::IOAddress& addr) const;
650 
658  void getLeases6Internal(Lease::Type type,
659  const DUID& duid,
660  uint32_t iaid,
661  Lease6Collection& collection) const;
662 
671  void getLeases6Internal(Lease::Type type,
672  const DUID& duid,
673  uint32_t iaid,
674  SubnetID subnet_id,
675  Lease6Collection& collection) const;
676 
681  void getLeases6Internal(SubnetID subnet_id,
682  Lease6Collection& collection) const;
683 
688  void getLeases6Internal(const std::string& hostname,
689  Lease6Collection& collection) const;
690 
694  void getLeases6Internal(Lease6Collection& collection) const;
695 
700  void getLeases6Internal(const DUID& duid,
701  Lease6Collection& collection) const;
702 
709  void getLeases6Internal(const asiolink::IOAddress& lower_bound_address,
710  const LeasePageSize& page_size,
711  Lease6Collection& collection) const;
712 
719  void getExpiredLeases4Internal(Lease4Collection& expired_leases,
720  const size_t max_leases) const;
721 
728  void getExpiredLeases6Internal(Lease6Collection& expired_leases,
729  const size_t max_leases) const;
730 
745  void updateLease4Internal(const Lease4Ptr& lease4);
746 
761  void updateLease6Internal(const Lease6Ptr& lease6);
762 
777  bool deleteLeaseInternal(const Lease4Ptr& addr);
778 
793  bool deleteLeaseInternal(const Lease6Ptr& addr);
794 
800  size_t wipeLeases4Internal(const SubnetID& subnet_id);
801 
807  size_t wipeLeases6Internal(const SubnetID& subnet_id);
809 
836  template<typename IndexType, typename LeaseType, typename StorageType,
837  typename LeaseFileType>
838  uint64_t deleteExpiredReclaimedLeases(const uint32_t secs,
839  const Universe& universe,
840  StorageType& storage,
841  LeaseFileType& lease_file);
842 
849  int64_t getSubnetStat(const SubnetID& subnet_id, const std::string& stat_label) const;
850 
861  bool getLeaseLimit(data::ConstElementPtr parent, Lease::Type ltype, size_t& limit) const;
862 
863 public:
864 
870  virtual std::string getType() const override {
871  return (std::string("memfile"));
872  }
873 
879  virtual std::string getName() const override {
880  return ("memory");
881  }
882 
888  virtual std::string getDescription() const override;
889 
894  virtual std::pair<uint32_t, uint32_t> getVersion() const override;
895 
900  virtual void commit() override;
901 
906  virtual void rollback() override;
907 
909 
911 
912 
917  enum LFCFileType {
924  };
925 
944  static std::string appendSuffix(const std::string& file_name,
945  const LFCFileType& file_type);
947 
948 
952 
953 
957  std::string getDefaultLeaseFilePath(Universe u) const;
958 
965  std::string getLeaseFilePath(Universe u) const;
966 
978  bool persistLeases(Universe u) const;
979 
981 
982 private:
983 
999  std::string initLeaseFilePath(Universe u);
1000 
1056  template<typename LeaseObjectType, typename LeaseFileType,
1057  typename StorageType>
1058  bool loadLeasesFromFiles(const std::string& filename,
1059  boost::shared_ptr<LeaseFileType>& lease_file,
1060  StorageType& storage);
1061 
1063  Lease4Storage storage4_;
1064 
1066  Lease6Storage storage6_;
1067 
1068 protected:
1069 
1072 
1075 
1077  boost::shared_ptr<CSVLeaseFile4> lease_file4_;
1078 
1080  boost::shared_ptr<CSVLeaseFile6> lease_file6_;
1081 
1082 public:
1083 
1088 
1089 
1093  bool isLFCRunning() const;
1094 
1097  int getLFCExitStatus() const;
1099 
1107  virtual LeaseStatsQueryPtr startLeaseStatsQuery4() override;
1108 
1117  virtual LeaseStatsQueryPtr startSubnetLeaseStatsQuery4(const SubnetID& subnet_id) override;
1118 
1128  virtual LeaseStatsQueryPtr startSubnetRangeLeaseStatsQuery4(const SubnetID& first_subnet_id,
1129  const SubnetID& last_subnet_id) override;
1130 
1138  virtual LeaseStatsQueryPtr startLeaseStatsQuery6() override;
1139 
1148  virtual LeaseStatsQueryPtr startSubnetLeaseStatsQuery6(const SubnetID& subnet_id) override;
1149 
1159  virtual LeaseStatsQueryPtr startSubnetRangeLeaseStatsQuery6(const SubnetID& first_subnet_id,
1160  const SubnetID& last_subnet_id) override;
1161 
1165 
1166 
1167 protected:
1168 
1180  virtual void lfcCallback();
1182 
1184 
1185 
1186 private:
1187 
1204  void lfcSetup(bool conversion_needed = false);
1205 
1228  template<typename LeaseFileType>
1229  void lfcExecute(boost::shared_ptr<LeaseFileType>& lease_file);
1230 
1232  boost::scoped_ptr<LFCSetup> lfc_setup_;
1233 
1238  db::DatabaseConnection conn_;
1239 
1241 
1243  boost::scoped_ptr<std::mutex> mutex_;
1244 
1246  ClassLeaseCounter class_lease_counter_;
1247 
1248 public:
1256  virtual size_t getClassLeaseCount(const ClientClass& client_class,
1257  const Lease::Type& ltype = Lease::TYPE_V4) const override;
1258 
1266  virtual void recountClassLeases4() override;
1267 
1275  virtual void recountClassLeases6() override;
1276 
1280  virtual void clearClassLeaseCounts() override;
1281 
1285 
1298  virtual Lease4Collection
1299  getLeases4ByRelayId(const OptionBuffer& relay_id,
1300  const asiolink::IOAddress& lower_bound_address,
1301  const LeasePageSize& page_size,
1302  const time_t& qry_start_time = 0,
1303  const time_t& qry_end_time = 0) override;
1304 
1317  virtual Lease4Collection
1318  getLeases4ByRemoteId(const OptionBuffer& remote_id,
1319  const asiolink::IOAddress& lower_bound_address,
1320  const LeasePageSize& page_size,
1321  const time_t& qry_start_time = 0,
1322  const time_t& qry_end_time = 0) override;
1323 
1334  virtual Lease6Collection
1335  getLeases6ByRelayId(const DUID& relay_id,
1336  const asiolink::IOAddress& link_addr,
1337  uint8_t link_len,
1338  const asiolink::IOAddress& lower_bound_address,
1339  const LeasePageSize& page_size) override;
1340 
1351  virtual Lease6Collection
1352  getLeases6ByRemoteId(const OptionBuffer& remote_id,
1353  const asiolink::IOAddress& link_addr,
1354  uint8_t link_len,
1355  const asiolink::IOAddress& lower_bound_address,
1356  const LeasePageSize& page_size) override;
1357 
1367  virtual Lease6Collection
1368  getLeases6ByLink(const asiolink::IOAddress& link_addr,
1369  uint8_t link_len,
1370  const asiolink::IOAddress& lower_bound_address,
1371  const LeasePageSize& page_size) override;
1372 
1382  virtual size_t buildExtendedInfoTables6(bool update, bool current) override;
1383 
1384 private:
1385 
1399  getLeases4ByRelayIdInternal(const OptionBuffer& relay_id,
1400  const asiolink::IOAddress& lower_bound_address,
1401  const LeasePageSize& page_size,
1402  const time_t& qry_start_time,
1403  const time_t& qry_end_time);
1404 
1418  getLeases4ByRemoteIdInternal(const OptionBuffer& remote_id,
1419  const asiolink::IOAddress& lower_bound_address,
1420  const LeasePageSize& page_size,
1421  const time_t& qry_start_time,
1422  const time_t& qry_end_time);
1423 
1435  getLeases6ByRelayIdInternal(const DUID& relay_id,
1436  const asiolink::IOAddress& link_addr,
1437  uint8_t link_len,
1438  const asiolink::IOAddress& lower_bound_address,
1439  const LeasePageSize& page_size);
1440 
1452  getLeases6ByRemoteIdInternal(const OptionBuffer& remote_id,
1453  const asiolink::IOAddress& link_addr,
1454  uint8_t link_len,
1455  const asiolink::IOAddress& lower_bound_address,
1456  const LeasePageSize& page_size);
1457 
1468  getLeases6ByLinkInternal(const asiolink::IOAddress& link_addr,
1469  uint8_t link_len,
1470  const asiolink::IOAddress& lower_bound_address,
1471  const LeasePageSize& page_size);
1472 
1479  size_t buildExtendedInfoTables6Internal(bool update, bool current);
1480 
1481 public:
1482 
1486  virtual void writeLeases4(const std::string& filename) override;
1487 
1491  virtual void writeLeases6(const std::string& filename) override;
1492 
1493 protected:
1494 
1496 
1500  virtual void deleteExtendedInfo6(const isc::asiolink::IOAddress& addr) override;
1501 
1506  virtual void addRelayId6(const isc::asiolink::IOAddress& lease_addr,
1507  const std::vector<uint8_t>& relay_id) override;
1508 
1513  virtual void addRemoteId6(const isc::asiolink::IOAddress& lease_addr,
1514  const std::vector<uint8_t>& remote_id) override;
1515 
1516 private:
1521  virtual void writeLeases4Internal(const std::string& filename);
1522 
1527  virtual void writeLeases6Internal(const std::string& filename);
1528 };
1529 
1530 } // namespace dhcp
1531 } // namespace isc
1532 
1533 #endif // MEMFILE_LEASE_MGR_H
virtual LeaseStatsQueryPtr startSubnetRangeLeaseStatsQuery6(const SubnetID &first_subnet_id, const SubnetID &last_subnet_id) override
Creates and runs the IPv6 lease stats query for a single subnet.
virtual void getExpiredLeases4(Lease4Collection &expired_leases, const size_t max_leases) const override
Returns a collection of expired DHCPv4 leases.
virtual ~Memfile_LeaseMgr()
Destructor (closes file)
virtual void recountClassLeases4() override
Recount the leases per class for V4 leases.
boost::shared_ptr< LeaseStatsQuery > LeaseStatsQueryPtr
Defines a pointer to a LeaseStatsQuery.
Definition: lease_mgr.h:210
Concrete implementation of a lease database backend using flat file.
virtual Lease6Collection getLeases6() const override
Returns all IPv6 leases.
Abstract Lease Manager.
Definition: lease_mgr.h:225
virtual std::string checkLimits4(isc::data::ConstElementPtr const &user_context) const override
Checks if the IPv4 lease limits set in the given user context are exceeded.
virtual size_t getClassLeaseCount(const ClientClass &client_class, const Lease::Type &ltype=Lease::TYPE_V4) const override
Returns the class lease count for a given class and lease type.
boost::multi_index_container< Lease6ExtendedInfoPtr, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::tag< RelayIdIndexTag >, boost::multi_index::composite_key< Lease6ExtendedInfo, boost::multi_index::member< Lease6ExtendedInfo, std::vector< uint8_t >, &Lease6ExtendedInfo::id_ >, boost::multi_index::member< Lease6ExtendedInfo, isc::asiolink::IOAddress, &Lease6ExtendedInfo::lease_addr_ > > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< LeaseAddressIndexTag >, boost::multi_index::member< Lease6ExtendedInfo, isc::asiolink::IOAddress, &Lease6ExtendedInfo::lease_addr_ > > >> Lease6ExtendedInfoRelayIdTable
A multi index container holding lease6 extended info for by relay id.
virtual Lease4Collection getLeases4() const override
Returns all IPv4 leases.
virtual Lease4Collection getLeases4ByRemoteId(const OptionBuffer &remote_id, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size, const time_t &qry_start_time=0, const time_t &qry_end_time=0) override
Returns existing IPv4 leases with a given remote-id.
An abstract API for lease database.
virtual void addRelayId6(const isc::asiolink::IOAddress &lease_addr, const std::vector< uint8_t > &relay_id) override
Add lease6 extended info into by-relay-id table.
virtual void updateLease4(const Lease4Ptr &lease4) override
Updates IPv4 lease.
std::vector< Lease4Ptr > Lease4Collection
A collection of IPv4 leases.
Definition: lease.h:508
Universe
Specifies universe (V4, V6)
boost::shared_ptr< CSVLeaseFile4 > lease_file4_
Holds the pointer to the DHCPv4 lease file IO.
virtual void writeLeases4(const std::string &filename) override
Write V4 leases to a file.
Common database connection class.
virtual uint64_t deleteExpiredReclaimedLeases4(const uint32_t secs) override
Deletes all expired-reclaimed DHCPv4 leases.
Memfile_LeaseMgr(const db::DatabaseConnection::ParameterMap &parameters)
The sole lease manager constructor.
boost::multi_index_container< Lease4Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< AddressIndexTag >, boost::multi_index::member< Lease, isc::asiolink::IOAddress, &Lease::addr_ > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< HWAddressSubnetIdIndexTag >, boost::multi_index::composite_key< Lease4, boost::multi_index::const_mem_fun< Lease, const std::vector< uint8_t > &, &Lease::getHWAddrVector >, boost::multi_index::member< Lease, SubnetID, &Lease::subnet_id_ > > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ClientIdSubnetIdIndexTag >, boost::multi_index::composite_key< Lease4, boost::multi_index::const_mem_fun< Lease4, const std::vector< uint8_t > &, &Lease4::getClientIdVector >, boost::multi_index::member< Lease, uint32_t, &Lease::subnet_id_ > > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ExpirationIndexTag >, boost::multi_index::composite_key< Lease4, boost::multi_index::const_mem_fun< Lease, bool, &Lease::stateExpiredReclaimed >, boost::multi_index::const_mem_fun< Lease, int64_t, &Lease::getExpirationTime > > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetIdIndexTag >, boost::multi_index::member< Lease, isc::dhcp::SubnetID, &Lease::subnet_id_ > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< HostnameIndexTag >, boost::multi_index::member< Lease, std::string, &Lease::hostname_ > > >> Lease4Storage
A multi index container holding DHCPv4 leases.
virtual Lease6Collection getLeases6ByLink(const asiolink::IOAddress &link_addr, uint8_t link_len, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) override
Returns existing IPv6 leases with on a given link.
virtual std::pair< uint32_t, uint32_t > getVersion() const override
Returns backend version.
virtual uint64_t deleteExpiredReclaimedLeases6(const uint32_t secs) override
Deletes all expired-reclaimed DHCPv6 leases.
virtual void getExpiredLeases6(Lease6Collection &expired_leases, const size_t max_leases) const override
Returns a collection of expired DHCPv6 leases.
LFCFileType
Types of the lease files used by the Lease File Cleanup.
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
Definition: option.h:24
Holds DUID (DHCPv6 Unique Identifier)
Definition: duid.h:27
virtual Lease4Collection getLeases4ByRelayId(const OptionBuffer &relay_id, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size, const time_t &qry_start_time=0, const time_t &qry_end_time=0) override
The following queries are used to fulfill Bulk Lease Query queries.
static std::string getDBVersion()
Class method to return extended version info This class method must be redeclared and redefined in de...
Definition: lease_mgr.cc:360
virtual Lease6Collection getLeases6ByRemoteId(const OptionBuffer &remote_id, const asiolink::IOAddress &link_addr, uint8_t link_len, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) override
Returns existing IPv6 leases with a given remote-id.
virtual void lfcCallback()
A callback function triggering Lease File Cleanup (LFC).
virtual void commit() override
Commit Transactions.
boost::multi_index_container< Lease6Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< AddressIndexTag >, boost::multi_index::member< Lease, isc::asiolink::IOAddress, &Lease::addr_ > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< DuidIaidTypeIndexTag >, boost::multi_index::composite_key< Lease6, boost::multi_index::const_mem_fun< Lease6, const std::vector< uint8_t > &, &Lease6::getDuidVector >, boost::multi_index::member< Lease6, uint32_t, &Lease6::iaid_ >, boost::multi_index::member< Lease6, Lease::Type, &Lease6::type_ > > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ExpirationIndexTag >, boost::multi_index::composite_key< Lease6, boost::multi_index::const_mem_fun< Lease, bool, &Lease::stateExpiredReclaimed >, boost::multi_index::const_mem_fun< Lease, int64_t, &Lease::getExpirationTime > > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetIdIndexTag >, boost::multi_index::member< Lease, isc::dhcp::SubnetID, &Lease::subnet_id_ > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< DuidIndexTag >, boost::multi_index::const_mem_fun< Lease6, const std::vector< uint8_t > &, &Lease6::getDuidVector > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< HostnameIndexTag >, boost::multi_index::member< Lease, std::string, &Lease::hostname_ > > >> Lease6Storage
A multi index container holding DHCPv6 leases.
bool isLFCRunning() const
Checks if the process performing lease file cleanup is running.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Definition: lease.h:294
virtual LeaseStatsQueryPtr startSubnetLeaseStatsQuery4(const SubnetID &subnet_id) override
Creates and runs the IPv4 lease stats query for a single subnet.
static const int MINOR_VERSION_V4
the minor version of the v4 memfile backend
Lease6ExtendedInfoRelayIdTable relay_id6_
stores IPv6 by-relay-id cross-reference table
virtual std::string getDescription() const override
Returns description of the backend.
virtual std::string getType() const override
Return backend type.
IPv4 lease.
Definition: lease.h:50
virtual std::string checkLimits6(isc::data::ConstElementPtr const &user_context) const override
Checks if the IPv6 lease limits set in the given user context are exceeded.
virtual size_t buildExtendedInfoTables6(bool update, bool current) override
Build extended info v6 tables.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
virtual LeaseStatsQueryPtr startLeaseStatsQuery6() override
Creates and runs the IPv6 lease stats query.
virtual LeaseStatsQueryPtr startSubnetRangeLeaseStatsQuery4(const SubnetID &first_subnet_id, const SubnetID &last_subnet_id) override
Creates and runs the IPv4 lease stats query for a single subnet.
virtual LeaseStatsQueryPtr startLeaseStatsQuery4() override
Creates and runs the IPv4 lease stats query.
virtual void writeLeases6(const std::string &filename) override
Write V6 leases to a file.
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
Definition: lease.h:671
boost::multi_index_container< Lease6ExtendedInfoPtr, boost::multi_index::indexed_by< boost::multi_index::hashed_non_unique< boost::multi_index::tag< RemoteIdIndexTag >, boost::multi_index::member< Lease6ExtendedInfo, std::vector< uint8_t >, &Lease6ExtendedInfo::id_ > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< LeaseAddressIndexTag >, boost::multi_index::member< Lease6ExtendedInfo, isc::asiolink::IOAddress, &Lease6ExtendedInfo::lease_addr_ > > >> Lease6ExtendedInfoRemoteIdTable
A multi index container holding lease6 extended info for by remote id.
virtual bool isJsonSupported() const override
Checks if JSON support is enabled in the database.
virtual size_t wipeLeases6(const SubnetID &subnet_id) override
Removed specified IPv6 leases.
virtual void updateLease6(const Lease6Ptr &lease6) override
Updates IPv6 lease.
virtual void deleteExtendedInfo6(const isc::asiolink::IOAddress &addr) override
Extended information / Bulk Lease Query shared interface.
virtual Lease6Ptr getLease6(Lease::Type type, const isc::asiolink::IOAddress &addr) const override
Returns existing IPv6 lease for a given IPv6 address.
virtual Lease6Collection getLeases6ByRelayId(const DUID &relay_id, const asiolink::IOAddress &link_addr, uint8_t link_len, const asiolink::IOAddress &lower_bound_address, const LeasePageSize &page_size) override
Returns existing IPv6 leases with a given relay-id.
std::string getLeaseFilePath(Universe u) const
Returns an absolute path to the lease file.
Defines the logger used by the top-level component of kea-lfc.
bool persistLeases(Universe u) const
Specifies whether or not leases are written to disk.
virtual Lease4Ptr getLease4(const isc::asiolink::IOAddress &addr) const override
Returns existing IPv4 lease for specified IPv4 address.
Container that maintains counts of leases per class and lease type.
std::string getDefaultLeaseFilePath(Universe u) const
Returns default path to the lease file.
virtual std::string getName() const override
Returns backend name.
virtual void recountClassLeases6() override
Recount the leases per class for V6 leases.
virtual size_t wipeLeases4(const SubnetID &subnet_id) override
Removes specified IPv4 leases.
Type
Type of lease or pool.
Definition: lease.h:46
Holds Client identifier or client IPv4 address.
Definition: duid.h:111
static const int MAJOR_VERSION_V4
Hardware type that represents information from DHCPv4 packet.
Definition: hwaddr.h:20
Lease6ExtendedInfoRemoteIdTable remote_id6_
stores IPv6 by-remote-id cross-reference table
Wraps value holding size of the page with leases.
Definition: lease_mgr.h:46
std::string ClientClass
Defines a single class name.
Definition: classify.h:42
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
virtual bool addLease(const Lease4Ptr &lease) override
Adds an IPv4 lease.
boost::shared_ptr< CSVLeaseFile6 > lease_file6_
Holds the pointer to the DHCPv6 lease file IO.
virtual LeaseStatsQueryPtr startSubnetLeaseStatsQuery6(const SubnetID &subnet_id) override
Creates and runs the IPv6 lease stats query for a single subnet.
int getLFCExitStatus() const
Returns the status code returned by the last executed LFC process.
virtual void clearClassLeaseCounts() override
Clears the class-lease count map.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
Definition: lease.h:513
static const int MINOR_VERSION_V6
the minor version of the v6 memfile backend
static std::string appendSuffix(const std::string &file_name, const LFCFileType &file_type)
Appends appropriate suffix to the file name.
virtual void addRemoteId6(const isc::asiolink::IOAddress &lease_addr, const std::vector< uint8_t > &remote_id) override
Add lease6 extended info into by-remote-id table.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Definition: subnet_id.h:25
virtual bool deleteLease(const Lease4Ptr &lease) override
Deletes an IPv4 lease.
virtual void rollback() override
Rollback Transactions.