summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/mysql_host_data_source.h
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2020-09-30 15:16:30 +0200
committerMarcin Siodelski <marcin@isc.org>2020-10-05 15:14:57 +0200
commitc7e9763582b72da958d91282c3cd8107ebb34487 (patch)
treefd360e6cedce77db7d8e3c4b1f4d1aa4020b438b /src/lib/dhcpsrv/mysql_host_data_source.h
parent[#1428] Allow non-unique IPs in MySQL and PgSQL (diff)
downloadkea-c7e9763582b72da958d91282c3cd8107ebb34487.tar.xz
kea-c7e9763582b72da958d91282c3cd8107ebb34487.zip
[#1428] Calls to fetch many hosts by id/address
The new calls have been added to the host backends to retrieve multiple hosts by subnet_id and address.
Diffstat (limited to 'src/lib/dhcpsrv/mysql_host_data_source.h')
-rw-r--r--src/lib/dhcpsrv/mysql_host_data_source.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/mysql_host_data_source.h b/src/lib/dhcpsrv/mysql_host_data_source.h
index f6266d4c67..6823e5a939 100644
--- a/src/lib/dhcpsrv/mysql_host_data_source.h
+++ b/src/lib/dhcpsrv/mysql_host_data_source.h
@@ -307,6 +307,33 @@ public:
virtual ConstHostPtr get4(const SubnetID& subnet_id,
const asiolink::IOAddress& address) const;
+ /// @brief Returns all hosts connected to the IPv4 subnet and having
+ /// a reservation for a specified address.
+ ///
+ /// In most cases it is desired that there is at most one reservation
+ /// for a given IPv4 address within a subnet. In a default configuration,
+ /// the backend does not allow for inserting more than one host with
+ /// the same IPv4 reservation. In that case, the number of hosts returned
+ /// by this function is 0 or 1.
+ ///
+ /// If the backend is configured to allow multiple hosts with reservations
+ /// for the same IPv4 address in the given subnet, this method can return
+ /// more than one host.
+ ///
+ /// The typical use case when a single IPv4 address is reserved for multiple
+ /// hosts is when these hosts represent different interfaces of the same
+ /// machine and each interface comes with a different MAC address. In that
+ /// case, the same IPv4 address is assigned regarless of which interface is
+ /// used by the DHCP client to communicate with the server.
+ ///
+ /// @param subnet_id Subnet identifier.
+ /// @param address reserved IPv4 address.
+ ///
+ /// @return Collection of const @c Host objects.
+ virtual ConstHostCollection
+ getAll4(const SubnetID& subnet_id,
+ const asiolink::IOAddress& address) const;
+
/// @brief Returns a host connected to the IPv6 subnet.
///
/// @param subnet_id Subnet identifier.
@@ -341,6 +368,33 @@ public:
virtual ConstHostPtr get6(const SubnetID& subnet_id,
const asiolink::IOAddress& address) const;
+ /// @brief Returns all hosts connected to the IPv6 subnet and having
+ /// a reservation for a specified address or delegated prefix (lease).
+ ///
+ /// In most cases it is desired that there is at most one reservation
+ /// for a given IPv6 lease within a subnet. In a default configuration,
+ /// the backend does not allow for inserting more than one host with
+ /// the same IPv6 address or prefix. In that case, the number of hosts
+ /// returned by this function is 0 or 1.
+ ///
+ /// If the backend is configured to allow multiple hosts with reservations
+ /// for the same IPv6 lease in the given subnet, this method can return
+ /// more than one host.
+ ///
+ /// The typical use case when a single IPv6 lease is reserved for multiple
+ /// hosts is when these hosts represent different interfaces of the same
+ /// machine and each interface comes with a different MAC address. In that
+ /// case, the same IPv6 lease is assigned regarless of which interface is
+ /// used by the DHCP client to communicate with the server.
+ ///
+ /// @param subnet_id Subnet identifier.
+ /// @param address reserved IPv6 address/prefix.
+ ///
+ /// @return Collection of const @c Host objects.
+ virtual ConstHostCollection
+ getAll6(const SubnetID& subnet_id,
+ const asiolink::IOAddress& address) const;
+
/// @brief Return backend type
///
/// Returns the type of the backend (e.g. "mysql", "memfile" etc.)