Kea 2.5.8
isc::dhcp::BaseHostDataSource Class Referenceabstract

Base interface for the classes implementing simple data source for host reservations. More...

#include <base_host_data_source.h>

+ Inheritance diagram for isc::dhcp::BaseHostDataSource:

Public Types

enum  IdType { ID_HWADDR = 0 , ID_DUID = 1 }
 Specifies the type of an identifier. More...
 

Public Member Functions

virtual ~BaseHostDataSource ()
 Default destructor implementation.
 
virtual void add (const HostPtr &host)=0
 Adds a new host to the collection.
 
virtual void commit ()
 Commit Transactions.
 
virtual bool del (const SubnetID &subnet_id, const asiolink::IOAddress &addr)=0
 Attempts to delete hosts by (subnet-id, address)
 
virtual bool del4 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)=0
 Attempts to delete a host by (subnet-id4, identifier, identifier-type)
 
virtual bool del6 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)=0
 Attempts to delete a host by (subnet-id6, identifier, identifier-type)
 
virtual ConstHostPtr get4 (const SubnetID &subnet_id, const asiolink::IOAddress &address) const =0
 Returns a host connected to the IPv4 subnet and having a reservation for a specified IPv4 address.
 
virtual ConstHostPtr get4 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const =0
 Returns a host connected to the IPv4 subnet.
 
virtual ConstHostPtr get6 (const asiolink::IOAddress &prefix, const uint8_t prefix_len) const =0
 Returns a host using the specified IPv6 prefix.
 
virtual ConstHostPtr get6 (const SubnetID &subnet_id, const asiolink::IOAddress &address) const =0
 Returns a host connected to the IPv6 subnet and having a reservation for a specified IPv6 address or prefix.
 
virtual ConstHostPtr get6 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const =0
 Returns a host connected to the IPv6 subnet.
 
virtual ConstHostCollection getAll (const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const =0
 Return all hosts connected to any subnet for which reservations have been made using a specified identifier.
 
virtual ConstHostCollection getAll4 (const asiolink::IOAddress &address) const =0
 Returns a collection of hosts using the specified IPv4 address.
 
virtual ConstHostCollection getAll4 (const SubnetID &subnet_id) const =0
 Return all hosts in a DHCPv4 subnet.
 
virtual ConstHostCollection getAll4 (const SubnetID &subnet_id, const asiolink::IOAddress &address) const =0
 Returns all hosts connected to the IPv4 subnet and having a reservation for a specified address.
 
virtual ConstHostCollection getAll6 (const asiolink::IOAddress &address) const =0
 Returns all hosts having a reservation for a specified address or delegated prefix (lease) in all subnets.
 
virtual ConstHostCollection getAll6 (const SubnetID &subnet_id) const =0
 Return all hosts in a DHCPv6 subnet.
 
virtual ConstHostCollection getAll6 (const SubnetID &subnet_id, const asiolink::IOAddress &address) const =0
 Returns all hosts connected to the IPv6 subnet and having a reservation for a specified address or delegated prefix (lease).
 
virtual ConstHostCollection getAllbyHostname (const std::string &hostname) const =0
 Return all hosts with a hostname.
 
virtual ConstHostCollection getAllbyHostname4 (const std::string &hostname, const SubnetID &subnet_id) const =0
 Return all hosts with a hostname in a DHCPv4 subnet.
 
virtual ConstHostCollection getAllbyHostname6 (const std::string &hostname, const SubnetID &subnet_id) const =0
 Return all hosts with a hostname in a DHCPv6 subnet.
 
virtual ConstHostCollection getPage4 (const SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const =0
 Returns range of hosts in a DHCPv4 subnet.
 
virtual ConstHostCollection getPage4 (size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const =0
 Returns range of hosts.
 
virtual ConstHostCollection getPage6 (const SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const =0
 Returns range of hosts in a DHCPv6 subnet.
 
virtual ConstHostCollection getPage6 (size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const =0
 Returns range of hosts.
 
virtual isc::db::DatabaseConnection::ParameterMap getParameters () const
 Return backend parameters.
 
virtual std::string getType () const =0
 Return backend type.
 
virtual bool isUnusable ()
 Flag which indicates if the host manager has at least one unusable connection.
 
virtual void rollback ()
 Rollback Transactions.
 
virtual bool setIPReservationsUnique (const bool unique)=0
 Controls whether IP reservations are unique or non-unique.
 
virtual void update (HostPtr const &host)
 Attempts to update an existing host entry.
 

Detailed Description

Base interface for the classes implementing simple data source for host reservations.

This abstract class defines an interface for the classes implementing basic data source for host reservations. This interface allows for adding new reservations (represented by Host objects) and retrieving these reservations using various parameters such as HW address or DUID, subnet identifier (either IPv4 or IPv6) or reserved IP address.

This interface DOES NOT specify the methods to manage existing host reservations such as to remove one IPv6 reservation but leave other reservations. It also lacks the methods used for preparing the data to be added to the SQL database: commit, rollback etc. Such methods are declared in other interfaces.

Definition at line 88 of file base_host_data_source.h.

Member Enumeration Documentation

◆ IdType

Specifies the type of an identifier.

This is currently used only by MySQL host data source for now, but it is envisaged that it will be used by other host data sources in the future. Also, this list will grow over time. It is likely that we'll implement other identifiers in the future, e.g. remote-id.

Those value correspond directly to dhcp_identifier_type in hosts table in MySQL schema.

Enumerator
ID_HWADDR 

Hardware address.

ID_DUID 

DUID/client-id.

Definition at line 100 of file base_host_data_source.h.

Constructor & Destructor Documentation

◆ ~BaseHostDataSource()

virtual isc::dhcp::BaseHostDataSource::~BaseHostDataSource ( )
inlinevirtual

Default destructor implementation.

Definition at line 106 of file base_host_data_source.h.

Member Function Documentation

◆ add()

virtual void isc::dhcp::BaseHostDataSource::add ( const HostPtr host)
pure virtual

Adds a new host to the collection.

The implementations of this method should guard against duplicate reservations for the same host, where possible. For example, when the reservation for the same HW address and subnet id is added twice, the implementation should throw an exception. Note, that usually it is impossible to guard against adding duplicated host, where one instance is identified by HW address, another one by DUID.

Parameters
hostPointer to the new Host object being added.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

Referenced by update().

◆ commit()

virtual void isc::dhcp::BaseHostDataSource::commit ( )
inlinevirtual

Commit Transactions.

Commits all pending database operations. On databases that don't support transactions, this is a no-op.

Reimplemented in isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

Definition at line 533 of file base_host_data_source.h.

◆ del()

virtual bool isc::dhcp::BaseHostDataSource::del ( const SubnetID subnet_id,
const asiolink::IOAddress addr 
)
pure virtual

Attempts to delete hosts by (subnet-id, address)

This method supports both v4 and v6.

Parameters
subnet_idsubnet identifier.
addrspecified address.
Returns
true if deletion was successful, false if the host was not there.
Exceptions
variousexceptions in case of errors

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ del4()

virtual bool isc::dhcp::BaseHostDataSource::del4 ( const SubnetID subnet_id,
const Host::IdentifierType identifier_type,
const uint8_t *  identifier_begin,
const size_t  identifier_len 
)
pure virtual

Attempts to delete a host by (subnet-id4, identifier, identifier-type)

This method supports v4 hosts only.

Parameters
subnet_idIPv4 Subnet identifier.
identifier_typeIdentifier type.
identifier_beginPointer to a beginning of a buffer containing an identifier.
identifier_lenIdentifier length.
Returns
true if deletion was successful, false if the host was not there.
Exceptions
variousexceptions in case of errors

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

Referenced by update().

◆ del6()

virtual bool isc::dhcp::BaseHostDataSource::del6 ( const SubnetID subnet_id,
const Host::IdentifierType identifier_type,
const uint8_t *  identifier_begin,
const size_t  identifier_len 
)
pure virtual

Attempts to delete a host by (subnet-id6, identifier, identifier-type)

This method supports v6 hosts only.

Parameters
subnet_idIPv6 Subnet identifier.
identifier_typeIdentifier type.
identifier_beginPointer to a beginning of a buffer containing an identifier.
identifier_lenIdentifier length.
Returns
true if deletion was successful, false if the host was not there.
Exceptions
variousexceptions in case of errors

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

Referenced by update().

◆ get4() [1/2]

virtual ConstHostPtr isc::dhcp::BaseHostDataSource::get4 ( const SubnetID subnet_id,
const asiolink::IOAddress address 
) const
pure virtual

Returns a host connected to the IPv4 subnet and having a reservation for a specified IPv4 address.

One of the use cases for this method is to detect collisions between dynamically allocated addresses and reserved addresses. When the new address is assigned to a client, the allocation mechanism should check if this address is not reserved for some other host and do not allocate this address if reservation is present.

Implementations of this method should guard against invalid addresses, such as IPv6 address.

Parameters
subnet_idSubnet identifier.
addressreserved IPv4 address.
Returns
Const Host object using a specified IPv4 address.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ get4() [2/2]

virtual ConstHostPtr isc::dhcp::BaseHostDataSource::get4 ( const SubnetID subnet_id,
const Host::IdentifierType identifier_type,
const uint8_t *  identifier_begin,
const size_t  identifier_len 
) const
pure virtual

Returns a host connected to the IPv4 subnet.

Parameters
subnet_idSubnet identifier.
identifier_typeIdentifier type.
identifier_beginPointer to a beginning of a buffer containing an identifier.
identifier_lenIdentifier length.
Returns
Const Host object for which reservation has been made using the specified identifier.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ get6() [1/3]

virtual ConstHostPtr isc::dhcp::BaseHostDataSource::get6 ( const asiolink::IOAddress prefix,
const uint8_t  prefix_len 
) const
pure virtual

Returns a host using the specified IPv6 prefix.

Parameters
prefixIPv6 prefix for which the Host object is searched.
prefix_lenIPv6 prefix length.
Returns
Const Host object using a specified IPv6 prefix.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ get6() [2/3]

virtual ConstHostPtr isc::dhcp::BaseHostDataSource::get6 ( const SubnetID subnet_id,
const asiolink::IOAddress address 
) const
pure virtual

Returns a host connected to the IPv6 subnet and having a reservation for a specified IPv6 address or prefix.

Parameters
subnet_idSubnet identifier.
addressreserved IPv6 address/prefix.
Returns
Const Host object using a specified IPv6 address/prefix.

Implemented in isc::dhcp::HostMgr, isc::dhcp::CfgHosts, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ get6() [3/3]

virtual ConstHostPtr isc::dhcp::BaseHostDataSource::get6 ( const SubnetID subnet_id,
const Host::IdentifierType identifier_type,
const uint8_t *  identifier_begin,
const size_t  identifier_len 
) const
pure virtual

Returns a host connected to the IPv6 subnet.

Parameters
subnet_idSubnet identifier.
identifier_typeIdentifier type.
identifier_beginPointer to a beginning of a buffer containing an identifier.
identifier_lenIdentifier length.
Returns
Const Host object for which reservation has been made using the specified identifier.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getAll()

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getAll ( const Host::IdentifierType identifier_type,
const uint8_t *  identifier_begin,
const size_t  identifier_len 
) const
pure virtual

Return all hosts connected to any subnet for which reservations have been made using a specified identifier.

This method returns all Host objects which represent reservations for a specified identifier. This method may return multiple hosts because a particular client may have reservations in multiple subnets.

Parameters
identifier_typeIdentifier type.
identifier_beginPointer to a beginning of a buffer containing an identifier.
identifier_lenIdentifier length.
Returns
Collection of const Host objects.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getAll4() [1/3]

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getAll4 ( const asiolink::IOAddress address) const
pure virtual

Returns a collection of hosts using the specified IPv4 address.

This method may return multiple Host objects if they are connected to different subnets.

Parameters
addressIPv4 address for which the Host object is searched.
Returns
Collection of const Host objects.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getAll4() [2/3]

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getAll4 ( const SubnetID subnet_id) const
pure virtual

Return all hosts in a DHCPv4 subnet.

This method returns all Host objects which represent reservations in a specified subnet.

Parameters
subnet_idSubnet identifier.
Returns
Collection of const Host objects.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getAll4() [3/3]

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getAll4 ( const SubnetID subnet_id,
const asiolink::IOAddress address 
) const
pure virtual

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 regardless of which interface is used by the DHCP client to communicate with the server.

Parameters
subnet_idSubnet identifier.
addressreserved IPv4 address
Returns
Collection of const Host objects.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getAll6() [1/3]

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getAll6 ( const asiolink::IOAddress address) const
pure virtual

Returns all hosts having a reservation for a specified address or delegated prefix (lease) in all subnets.

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.

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 per subnet.

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 regardless of which interface is used by the DHCP client to communicate with the server.

Parameters
addressreserved IPv6 address/prefix.
Returns
Collection of const Host objects.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getAll6() [2/3]

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getAll6 ( const SubnetID subnet_id) const
pure virtual

Return all hosts in a DHCPv6 subnet.

This method returns all Host objects which represent reservations in a specified subnet.

Parameters
subnet_idSubnet identifier.
Returns
Collection of const Host objects.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getAll6() [3/3]

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getAll6 ( const SubnetID subnet_id,
const asiolink::IOAddress address 
) const
pure virtual

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 regardless of which interface is used by the DHCP client to communicate with the server.

Parameters
subnet_idSubnet identifier.
addressreserved IPv6 address/prefix.
Returns
Collection of const Host objects.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getAllbyHostname()

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getAllbyHostname ( const std::string &  hostname) const
pure virtual

Return all hosts with a hostname.

This method returns all Host objects which represent reservations using a specified hostname.

Note
: as hostnames are case-insensitive the search key is given in lower cases, search indexes should either be case-insensitive or be case-sensitive using the lower case version of hostnames.
Parameters
hostnameThe lower case hostname.
Returns
Collection of const Host objects.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getAllbyHostname4()

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getAllbyHostname4 ( const std::string &  hostname,
const SubnetID subnet_id 
) const
pure virtual

Return all hosts with a hostname in a DHCPv4 subnet.

This method returns all Host objects which represent reservations using a specified hostname in a specified subnet.

Parameters
hostnameThe lower case hostname.
subnet_idSubnet identifier.
Returns
Collection of const Host objects.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getAllbyHostname6()

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getAllbyHostname6 ( const std::string &  hostname,
const SubnetID subnet_id 
) const
pure virtual

Return all hosts with a hostname in a DHCPv6 subnet.

This method returns all Host objects which represent reservations using a specified hostname in a specified subnet.

Parameters
hostnameThe lower case hostname.
subnet_idSubnet identifier.
Returns
Collection of const Host objects.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getPage4() [1/2]

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getPage4 ( const SubnetID subnet_id,
size_t &  source_index,
uint64_t  lower_host_id,
const HostPageSize page_size 
) const
pure virtual

Returns range of hosts in a DHCPv4 subnet.

This method implements paged browsing of host databases. The parameters specify a page size, an index in sources and the starting host id of the range. If not zero this host id is excluded from the returned range. When a source is exhausted the index is updated. There is no guarantee about the order of returned host reservations, only the sources and reservations from the same source are ordered.

Parameters
subnet_idSubnet identifier.
source_indexIndex of the source.
lower_host_idHost identifier used as lower bound for the returned range.
page_sizemaximum size of the page returned.
Returns
Host collection (may be empty).

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getPage4() [2/2]

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getPage4 ( size_t &  source_index,
uint64_t  lower_host_id,
const HostPageSize page_size 
) const
pure virtual

Returns range of hosts.

This method implements paged browsing of host databases. The parameters specify a page size, an index in sources and the starting host id of the range. If not zero this host id is excluded from the returned range. When a source is exhausted the index is updated. There is no guarantee about the order of returned host reservations, only the sources and reservations from the same source are ordered.

Parameters
source_indexIndex of the source.
lower_host_idHost identifier used as lower bound for the returned range.
page_sizemaximum size of the page returned.
Returns
Host collection (may be empty).

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getPage6() [1/2]

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getPage6 ( const SubnetID subnet_id,
size_t &  source_index,
uint64_t  lower_host_id,
const HostPageSize page_size 
) const
pure virtual

Returns range of hosts in a DHCPv6 subnet.

This method implements paged browsing of host databases. The parameters specify a page size, an index in sources and the starting host id of the range. If not zero this host id is excluded from the returned range. When a source is exhausted the index is updated. There is no guarantee about the order of returned host reservations, only the sources and reservations from the same source are ordered.

Parameters
subnet_idSubnet identifier.
source_indexIndex of the source.
lower_host_idHost identifier used as lower bound for the returned range.
page_sizemaximum size of the page returned.
Returns
Host collection (may be empty).

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getPage6() [2/2]

virtual ConstHostCollection isc::dhcp::BaseHostDataSource::getPage6 ( size_t &  source_index,
uint64_t  lower_host_id,
const HostPageSize page_size 
) const
pure virtual

Returns range of hosts.

This method implements paged browsing of host databases. The parameters specify a page size, an index in sources and the starting host id of the range. If not zero this host id is excluded from the returned range. When a source is exhausted the index is updated. There is no guarantee about the order of returned host reservations, only the sources and reservations from the same source are ordered.

Parameters
source_indexIndex of the source.
lower_host_idHost identifier used as lower bound for the returned range.
page_sizemaximum size of the page returned.
Returns
Host collection (may be empty).

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ getParameters()

virtual isc::db::DatabaseConnection::ParameterMap isc::dhcp::BaseHostDataSource::getParameters ( ) const
inlinevirtual

Return backend parameters.

Returns the backend parameters

Returns
Parameters of the backend.

Reimplemented in isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

Definition at line 525 of file base_host_data_source.h.

◆ getType()

virtual std::string isc::dhcp::BaseHostDataSource::getType ( ) const
pure virtual

Return backend type.

Returns the type of the backend (e.g. "mysql", "memfile" etc.)

Returns
Type of the backend.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ isUnusable()

virtual bool isc::dhcp::BaseHostDataSource::isUnusable ( )
inlinevirtual

Flag which indicates if the host manager has at least one unusable connection.

Returns
true if there is at least one unusable connection, false otherwise

Reimplemented in isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

Definition at line 566 of file base_host_data_source.h.

◆ rollback()

virtual void isc::dhcp::BaseHostDataSource::rollback ( )
inlinevirtual

Rollback Transactions.

Rolls back all pending database operations. On databases that don't support transactions, this is a no-op.

Reimplemented in isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

Definition at line 539 of file base_host_data_source.h.

◆ setIPReservationsUnique()

virtual bool isc::dhcp::BaseHostDataSource::setIPReservationsUnique ( const bool  unique)
pure virtual

Controls whether IP reservations are unique or non-unique.

In a typical case, the IP reservations are unique and backends verify prior to adding a host reservation to the database that the reservation for a given IP address/subnet does not exist. In some cases it may be required to allow non-unique IP reservations, e.g. in the case when a host has several interfaces and independently of which interface is used by this host to communicate with the DHCP server the same IP address should be assigned. In this case the unique value should be set to false to disable the checks for uniqueness on the backend side.

All backends are required to support the case when unique setting is true and they must use this setting by default.

Parameters
uniqueboolean flag indicating if the IP reservations must be unique or can be non-unique.
Returns
true if the new setting was accepted by the backend or false otherwise.

Implemented in isc::dhcp::CfgHosts, isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

◆ update()

virtual void isc::dhcp::BaseHostDataSource::update ( HostPtr const &  host)
inlinevirtual

Attempts to update an existing host entry.

The implementation is common to multiple host data sources, so let's provide it in the base host data source. In some instances, it may require synchronization e.g. with transactions in case of databases.

Parameters
hostthe host up to date with the requested changes

Reimplemented in isc::dhcp::HostMgr, isc::dhcp::MySqlHostDataSource, and isc::dhcp::PgSqlHostDataSource.

Definition at line 494 of file base_host_data_source.h.

References add(), del4(), del6(), and isc_throw.

Referenced by isc::dhcp::MySqlHostDataSource::update(), and isc::dhcp::PgSqlHostDataSource::update().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: