Kea 2.7.6
isc::dhcp::HostMgr Class Reference

Host Manager. More...

#include <host_mgr.h>

+ Inheritance diagram for isc::dhcp::HostMgr:

Public Member Functions

virtual void add (const HostPtr &host)
 The HostMgr::add compatible with BaseHostDataSource interfaces.
 
void add (const HostPtr &host, const HostMgrOperationTarget target)
 Adds a new host to the alternate data source.
 
virtual bool del (const SubnetID &subnet_id, const asiolink::IOAddress &addr)
 The HostMgr::del compatible with BaseHostDataSource interfaces.
 
bool del (const SubnetID &subnet_id, const asiolink::IOAddress &addr, const HostMgrOperationTarget target)
 Attempts to delete hosts by address.
 
virtual bool del4 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
 The HostMgr::del4 compatible with BaseHostDataSource interfaces.
 
bool del4 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target)
 Attempts to delete a host by (subnet4-id, identifier, identifier-type, operation-target)
 
virtual bool del6 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len)
 The HostMgr::del6 compatible with BaseHostDataSource interfaces.
 
bool del6 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target)
 Attempts to delete a host by (subnet6-id, identifier, identifier-type, operation-target)
 
virtual ConstHostPtr get4 (const SubnetID &subnet_id, const asiolink::IOAddress &address) const
 The HostMgr::get4 compatible with BaseHostDataSource interfaces.
 
ConstHostPtr get4 (const SubnetID &subnet_id, const asiolink::IOAddress &address, const HostMgrOperationTarget target) const
 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
 The HostMgr::get4 compatible with BaseHostDataSource interfaces.
 
ConstHostPtr get4 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
 Returns a host connected to the IPv4 subnet.
 
virtual ConstHostPtr get4Any (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
 The HostMgr::get4Any compatible with BaseHostDataSource interfaces.
 
ConstHostPtr get4Any (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
 Returns any host connected to the IPv4 subnet.
 
virtual ConstHostPtr get6 (const asiolink::IOAddress &prefix, const uint8_t prefix_len) const
 The HostMgr::get6 compatible with BaseHostDataSource interfaces.
 
ConstHostPtr get6 (const asiolink::IOAddress &prefix, const uint8_t prefix_len, const HostMgrOperationTarget target) const
 Returns a host using the specified IPv6 prefix.
 
virtual ConstHostPtr get6 (const SubnetID &subnet_id, const asiolink::IOAddress &addr) const
 The HostMgr::get6 compatible with BaseHostDataSource interfaces.
 
ConstHostPtr get6 (const SubnetID &subnet_id, const asiolink::IOAddress &addr, const HostMgrOperationTarget target) const
 Returns a host from specific subnet and reserved address.
 
virtual ConstHostPtr get6 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
 The HostMgr::get6 compatible with BaseHostDataSource interfaces.
 
ConstHostPtr get6 (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
 Returns a host connected to the IPv6 subnet.
 
virtual ConstHostPtr get6Any (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
 The HostMgr::get6Any compatible with BaseHostDataSource interfaces.
 
ConstHostPtr get6Any (const SubnetID &subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
 Returns any 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
 The HostMgr::getAll compatible with BaseHostDataSource interfaces.
 
ConstHostCollection getAll (const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len, const HostMgrOperationTarget target) const
 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
 The HostMgr::getAll4 compatible with BaseHostDataSource interfaces.
 
ConstHostCollection getAll4 (const asiolink::IOAddress &address, const HostMgrOperationTarget target) const
 Returns a collection of hosts using the specified IPv4 address.
 
virtual ConstHostCollection getAll4 (const SubnetID &subnet_id) const
 The HostMgr::getAll4 compatible with BaseHostDataSource interfaces.
 
virtual ConstHostCollection getAll4 (const SubnetID &subnet_id, const asiolink::IOAddress &address) const
 The HostMgr::getAll4 compatible with BaseHostDataSource interfaces.
 
ConstHostCollection getAll4 (const SubnetID &subnet_id, const asiolink::IOAddress &address, const HostMgrOperationTarget target) const
 Returns all hosts connected to the IPv4 subnet and having a reservation for a specified address.
 
ConstHostCollection getAll4 (const SubnetID &subnet_id, const HostMgrOperationTarget target) const
 Return all hosts in a DHCPv4 subnet.
 
virtual ConstHostCollection getAll6 (const asiolink::IOAddress &address) const
 The HostMgr::getAll6 compatible with BaseHostDataSource interfaces.
 
ConstHostCollection getAll6 (const asiolink::IOAddress &address, const HostMgrOperationTarget target) const
 Returns a collection of hosts using the specified IPv6 address/prefix.
 
virtual ConstHostCollection getAll6 (const SubnetID &subnet_id) const
 The HostMgr::getAll6 compatible with BaseHostDataSource interfaces.
 
virtual ConstHostCollection getAll6 (const SubnetID &subnet_id, const asiolink::IOAddress &address) const
 The HostMgr::getAll6 compatible with BaseHostDataSource interfaces.
 
ConstHostCollection getAll6 (const SubnetID &subnet_id, const asiolink::IOAddress &address, const HostMgrOperationTarget target) const
 Returns all hosts connected to the IPv6 subnet and having a reservation for a specified address or delegated prefix (lease).
 
ConstHostCollection getAll6 (const SubnetID &subnet_id, const HostMgrOperationTarget target) const
 Return all hosts in a DHCPv6 subnet.
 
virtual ConstHostCollection getAllbyHostname (const std::string &hostname) const
 The HostMgr::getAllbyHostname compatible with BaseHostDataSource interfaces.
 
ConstHostCollection getAllbyHostname (const std::string &hostname, const HostMgrOperationTarget target) const
 Return all hosts with a hostname.
 
virtual ConstHostCollection getAllbyHostname4 (const std::string &hostname, const SubnetID &subnet_id) const
 The HostMgr::getAllbyHostname4 compatible with BaseHostDataSource interfaces.
 
ConstHostCollection getAllbyHostname4 (const std::string &hostname, const SubnetID &subnet_id, const HostMgrOperationTarget target) const
 Return all hosts with a hostname in a DHCPv4 subnet.
 
virtual ConstHostCollection getAllbyHostname6 (const std::string &hostname, const SubnetID &subnet_id) const
 The HostMgr::getAllbyHostname6 compatible with BaseHostDataSource interfaces.
 
ConstHostCollection getAllbyHostname6 (const std::string &hostname, const SubnetID &subnet_id, const HostMgrOperationTarget target) const
 Return all hosts with a hostname in a DHCPv6 subnet.
 
bool getDisableSingleQuery () const
 Returns the disable single query flag.
 
HostDataSourcePtr getHostDataSource () const
 Returns the first host data source.
 
HostDataSourceListgetHostDataSourceList ()
 Returns the host data source list.
 
bool getIPReservationsUnique () const
 Returns the boolean flag indicating if the IP reservations must be unique or can be non-unique.
 
bool getNegativeCaching () const
 Returns the negative caching flag.
 
virtual ConstHostCollection getPage4 (const SubnetID &subnet_id, size_t &source_index, uint64_t lower_host_id, const HostPageSize &page_size) const
 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
 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
 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
 Returns range of hosts.
 
virtual std::string getType () const
 Return backend type.
 
void setDisableSingleQuery (bool disable_single_query)
 Sets the disable single query flag.
 
virtual bool setIPReservationsUnique (const bool unique)
 Controls whether IP reservations are unique or non-unique.
 
void setNegativeCaching (bool negative_caching)
 Sets the negative caching flag.
 
void update (HostPtr const &host)
 The HostMgr::update with default operation target.
 
void update (HostPtr const &host, const HostMgrOperationTarget target)
 Implements BaseHostDataSource::update() for alternate sources.
 
- Public Member Functions inherited from isc::dhcp::BaseHostDataSource
virtual ~BaseHostDataSource ()
 Default destructor implementation.
 
virtual void commit ()
 Commit Transactions.
 
virtual isc::db::DatabaseConnection::ParameterMap getParameters () const
 Return backend parameters.
 
virtual bool isUnusable ()
 Flag which indicates if the host manager has at least one unusable connection.
 
virtual void rollback ()
 Rollback Transactions.
 

Static Public Member Functions

static void addBackend (const std::string &access)
 Add an alternate host backend (aka host data source).
 
static bool checkCacheBackend (bool logging=false)
 Check for the cache host backend.
 
static void create ()
 Creates new instance of the HostMgr.
 
static void delAllBackends ()
 Delete all alternate backends.
 
static bool delBackend (const std::string &db_type)
 Delete an alternate host backend (aka host data source).
 
static bool delBackend (const std::string &db_type, const std::string &access, bool if_unusable=false)
 Delete an alternate host backend (aka host data source).
 
static HostMgrinstance ()
 Returns a sole instance of the HostMgr.
 

Protected Member Functions

virtual void cache (ConstHostPtr host) const
 Cache an answer.
 
virtual void cacheNegative (const SubnetID &ipv4_subnet_id, const SubnetID &ipv6_subnet_id, const Host::IdentifierType &identifier_type, const uint8_t *identifier_begin, const size_t identifier_len) const
 Cache a negative answer.
 

Protected Attributes

bool disable_single_query_
 The disable single query flag.
 
bool negative_caching_
 The negative caching flag.
 

Additional Inherited Members

- Public Types inherited from isc::dhcp::BaseHostDataSource
enum  IdType { ID_HWADDR = 0 , ID_DUID = 1 }
 Specifies the type of an identifier. More...
 

Detailed Description

Host Manager.

This is a singleton class which provides access to multiple sources of information about static host reservations. These sources are also referred to as host data sources. Each source derives (directly or indirectly) from the BaseHostDataSource.

The HostMgr is a central point for providing information about the host reservations. Internally, it relays the queries (calls to the appropriate methods declared in the BaseHostDataSource) to the data sources it is connected to. The HostMgr is always connected to the server's configuration, accessible through the CfgHosts object in the CfgMgr. The CfgHosts object holds all reservations specified in the DHCP server configuration file. If a particular reservation is not found in the CfgHosts object, the HostMgr will try to find it using alternate host data storages. An alternate host data storage is usually a database (e.g. SQL database), accessible through a dedicated host data source object (a.k.a. database backend). This datasource is responsible for managing the connection with the database and forming appropriate queries to retrieve (or update) the information about the reservations.

The use of alternate host data sources is optional and usually requires additional configuration to be specified by the server administrator. For example, for the SQL database the user's credentials, database address, and database name are required. The HostMgr passes these parameters to an appropriate datasource which is responsible for opening a connection and maintaining it.

It is possible to switch to different alternate data sources or disable the use of alternate datasources, e.g. as a result of server's reconfiguration. However, the use of the primary host data source (i.e. reservations specified in the configuration file) can't be disabled.

Definition at line 68 of file host_mgr.h.

Member Function Documentation

◆ add() [1/2]

void isc::dhcp::HostMgr::add ( const HostPtr & host)
virtual

The HostMgr::add compatible with BaseHostDataSource interfaces.

Operates on alternate host sources only.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 789 of file host_mgr.cc.

References add(), and isc::dhcp::ALTERNATE_SOURCES.

+ Here is the call graph for this function:

◆ add() [2/2]

void isc::dhcp::HostMgr::add ( const HostPtr & host,
const HostMgrOperationTarget target )

Adds a new host to the alternate data source.

This method will throw an exception if no alternate data source is in use.

Parameters
hostPointer to the new Host object being added.
targetThe host data source being a target of the operation.

Definition at line 764 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, cache(), isc_throw, and isc::dhcp::PRIMARY_SOURCE.

Referenced by add().

+ Here is the call graph for this function:

◆ addBackend()

void isc::dhcp::HostMgr::addBackend ( const std::string & access)
static

Add an alternate host backend (aka host data source).

Parameters
accessHost backend access parameters for the alternate host backend. It holds "keyword=value" pairs, separated by spaces.

The supported values are specific to the alternate backend in use. However, the "type" parameter will be common and it will specify which backend is to be used. Currently, no parameters are supported and the parameter is ignored.

Definition at line 57 of file host_mgr.cc.

References isc::dhcp::HostDataSourceFactory::add().

Referenced by isc::dhcp::CfgDbAccess::createManagers().

+ Here is the call graph for this function:

◆ cache()

void isc::dhcp::HostMgr::cache ( ConstHostPtr host) const
protectedvirtual

Cache an answer.

Parameters
hostPointer to the missed host.

Definition at line 927 of file host_mgr.cc.

Referenced by add(), get4(), get4Any(), get6(), get6(), get6Any(), and update().

◆ cacheNegative()

void isc::dhcp::HostMgr::cacheNegative ( const SubnetID & ipv4_subnet_id,
const SubnetID & ipv6_subnet_id,
const Host::IdentifierType & identifier_type,
const uint8_t * identifier_begin,
const size_t identifier_len ) const
protectedvirtual

Cache a negative answer.

Parameters
ipv4_subnet_idIdentifier of the IPv4 subnet.
ipv6_subnet_idIdentifier of the IPv6 subnet.
identifier_typeIdentifier type.
identifier_beginPointer to a beginning of the Identifier.
identifier_lenIdentifier length.

Definition at line 940 of file host_mgr.cc.

References isc::asiolink::IOAddress::IPV4_ZERO_ADDRESS(), and negative_caching_.

Referenced by get4(), and get6().

+ Here is the call graph for this function:

◆ checkCacheBackend()

bool isc::dhcp::HostMgr::checkCacheBackend ( bool logging = false)
static

Check for the cache host backend.

Checks if the first host backend implements the cache abstract class and sets cache_ptr_.

Parameters
loggingWhen true (not the default) emit an informational log.
Returns
true if the first host backend is a cache.

Definition at line 92 of file host_mgr.cc.

References isc::dhcp::HOSTS_CFG_CACHE_HOST_DATA_SOURCE, isc::dhcp::hosts_logger, and LOG_INFO.

Referenced by isc::dhcp::CfgDbAccess::createManagers().

◆ create()

void isc::dhcp::HostMgr::create ( )
static

Creates new instance of the HostMgr.

If an instance of the HostMgr already exists, it will be replaced by the new instance. Thus, any instances of alternate host data sources will be dropped.

Definition at line 52 of file host_mgr.cc.

Referenced by isc::dhcp::ControlledDhcpv4Srv::~ControlledDhcpv4Srv(), isc::dhcp::ControlledDhcpv6Srv::~ControlledDhcpv6Srv(), isc::dhcp::Dhcpv4Srv::~Dhcpv4Srv(), isc::dhcp::Dhcpv6Srv::~Dhcpv6Srv(), isc::dhcp::CfgDbAccess::createManagers(), instance(), isc::dhcp::ControlledDhcpv4Srv::processConfig(), and isc::dhcp::ControlledDhcpv6Srv::processConfig().

◆ del() [1/2]

bool isc::dhcp::HostMgr::del ( const SubnetID & subnet_id,
const asiolink::IOAddress & addr )
virtual

The HostMgr::del compatible with BaseHostDataSource interfaces.

Operates on alternate host sources only.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 819 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and del().

+ Here is the call graph for this function:

◆ del() [2/2]

bool isc::dhcp::HostMgr::del ( const SubnetID & subnet_id,
const asiolink::IOAddress & addr,
const HostMgrOperationTarget target )

Attempts to delete hosts by address.

It deletes hosts from the first alternate source in which at least one matching host is found. In unlikely case that the hosts having the same IP address exist in other alternate sources, the hosts from these other sources are not deleted.

This method supports both v4 and v6.

Parameters
subnet_idsubnet identifier.
addrspecified address.
targetThe host data source being a target of the operation.
Returns
true if deletion was successful, false otherwise.

Definition at line 794 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, isc_throw, and isc::dhcp::PRIMARY_SOURCE.

Referenced by del().

◆ del4() [1/2]

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

The HostMgr::del4 compatible with BaseHostDataSource interfaces.

Operates on alternate host sources only.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 854 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and del4().

+ Here is the call graph for this function:

◆ del4() [2/2]

bool isc::dhcp::HostMgr::del4 ( const SubnetID & subnet_id,
const Host::IdentifierType & identifier_type,
const uint8_t * identifier_begin,
const size_t identifier_len,
const HostMgrOperationTarget target )

Attempts to delete a host by (subnet4-id, identifier, identifier-type, operation-target)

This method supports v4 only.

Parameters
subnet_idIPv4 Subnet identifier.
identifier_typeIdentifier type.
identifier_beginPointer to a beginning of a buffer containing an identifier.
identifier_lenIdentifier length.
targetThe host data source being a target of the operation.
Returns
true if deletion was successful, false otherwise.

Definition at line 824 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, del4(), isc_throw, and isc::dhcp::PRIMARY_SOURCE.

Referenced by del4(), and del4().

+ Here is the call graph for this function:

◆ del6() [1/2]

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

The HostMgr::del6 compatible with BaseHostDataSource interfaces.

Operates on alternate host sources only.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 891 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and del6().

+ Here is the call graph for this function:

◆ del6() [2/2]

bool isc::dhcp::HostMgr::del6 ( const SubnetID & subnet_id,
const Host::IdentifierType & identifier_type,
const uint8_t * identifier_begin,
const size_t identifier_len,
const HostMgrOperationTarget target )

Attempts to delete a host by (subnet6-id, identifier, identifier-type, operation-target)

This method supports v6 only.

Parameters
subnet_idIPv6 Subnet identifier.
identifier_typeIdentifier type.
identifier_beginPointer to a beginning of a buffer containing an identifier.
identifier_lenIdentifier length.
targetThe host data source being a target of the operation.
Returns
true if deletion was successful, false otherwise.

Definition at line 861 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, del6(), isc_throw, and isc::dhcp::PRIMARY_SOURCE.

Referenced by del6(), and del6().

+ Here is the call graph for this function:

◆ delAllBackends()

void isc::dhcp::HostMgr::delAllBackends ( )
static

Delete all alternate backends.

Definition at line 79 of file host_mgr.cc.

◆ delBackend() [1/2]

bool isc::dhcp::HostMgr::delBackend ( const std::string & db_type)
static

Delete an alternate host backend (aka host data source).

Parameters
db_typedatabase backend type.
Returns
true when found and removed, false when not found.

Definition at line 62 of file host_mgr.cc.

References isc::dhcp::HostDataSourceFactory::del().

+ Here is the call graph for this function:

◆ delBackend() [2/2]

bool isc::dhcp::HostMgr::delBackend ( const std::string & db_type,
const std::string & access,
bool if_unusable = false )
static

Delete an alternate host backend (aka host data source).

Parameters
db_typedatabase backend type.
accessHost backend access parameters for the alternate host backend. It holds "keyword=value" pairs, separated by spaces.
if_unusableflag which indicates if the host data source should be deleted only if it is unusable.
Returns
false when not removed because it is not found or because it is still usable (if_unusable is true), true otherwise.

Definition at line 72 of file host_mgr.cc.

References isc::dhcp::HostDataSourceFactory::del().

+ Here is the call graph for this function:

◆ get4() [1/4]

ConstHostPtr isc::dhcp::HostMgr::get4 ( const SubnetID & subnet_id,
const asiolink::IOAddress & address ) const
virtual

The HostMgr::get4 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 522 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and get4().

+ Here is the call graph for this function:

◆ get4() [2/4]

ConstHostPtr isc::dhcp::HostMgr::get4 ( const SubnetID & subnet_id,
const asiolink::IOAddress & address,
const HostMgrOperationTarget target ) const

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

This method returns a single reservation for the particular host (identified by the HW address or DUID) as documented in the BaseHostDataSource::get4.

Parameters
subnet_idSubnet identifier.
addressreserved IPv4 address.
targetThe host data source being a target of the operation.
Returns
Const Host object using a specified IPv4 address.

Definition at line 491 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, cache(), isc::dhcp::HOSTS_DBG_TRACE, isc::dhcp::hosts_logger, isc::dhcp::HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_ADDRESS4, LOG_DEBUG, isc::dhcp::PRIMARY_SOURCE, and isc::asiolink::IOAddress::toText().

+ Here is the call graph for this function:

◆ get4() [3/4]

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

The HostMgr::get4 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 482 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and get4().

+ Here is the call graph for this function:

◆ get4() [4/4]

ConstHostPtr isc::dhcp::HostMgr::get4 ( const SubnetID & subnet_id,
const Host::IdentifierType & identifier_type,
const uint8_t * identifier_begin,
const size_t identifier_len,
const HostMgrOperationTarget target ) const

Returns a host connected to the IPv4 subnet.

This method returns a single reservation for a particular host as documented in the BaseHostDataSource::get4.

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

Definition at line 465 of file host_mgr.cc.

References cacheNegative(), get4Any(), and negative_caching_.

Referenced by isc::dhcp::AllocEngine::findGlobalReservation(), isc::dhcp::AllocEngine::findReservation(), get4(), and get4().

+ Here is the call graph for this function:

◆ get4Any() [1/2]

ConstHostPtr isc::dhcp::HostMgr::get4Any ( const SubnetID & subnet_id,
const Host::IdentifierType & identifier_type,
const uint8_t * identifier_begin,
const size_t identifier_len ) const
virtual

The HostMgr::get4Any compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Definition at line 456 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and get4Any().

+ Here is the call graph for this function:

◆ get4Any() [2/2]

ConstHostPtr isc::dhcp::HostMgr::get4Any ( const SubnetID & subnet_id,
const Host::IdentifierType & identifier_type,
const uint8_t * identifier_begin,
const size_t identifier_len,
const HostMgrOperationTarget target ) const

Returns any host connected to the IPv4 subnet.

This method returns a single reservation for a particular host as documented in the BaseHostDataSource::get4 even when the reservation is marked as from negative caching. This allows to monitor negative caching.

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

Definition at line 401 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, cache(), isc::dhcp::Host::getIdentifierAsText(), isc::dhcp::HOSTS_DBG_RESULTS, isc::dhcp::HOSTS_DBG_TRACE, isc::dhcp::hosts_logger, isc::dhcp::HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_IDENTIFIER, isc::dhcp::HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_IDENTIFIER_HOST, isc::dhcp::HOSTS_MGR_ALTERNATE_GET4_SUBNET_ID_IDENTIFIER_NULL, LOG_DEBUG, and isc::dhcp::PRIMARY_SOURCE.

Referenced by get4(), and get4Any().

+ Here is the call graph for this function:

◆ get6() [1/6]

ConstHostPtr isc::dhcp::HostMgr::get6 ( const asiolink::IOAddress & prefix,
const uint8_t prefix_len ) const
virtual

The HostMgr::get6 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 585 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and get6().

+ Here is the call graph for this function:

◆ get6() [2/6]

ConstHostPtr isc::dhcp::HostMgr::get6 ( const asiolink::IOAddress & prefix,
const uint8_t prefix_len,
const HostMgrOperationTarget target ) const

Returns a host using the specified IPv6 prefix.

This method returns a host using specified IPv6 prefix, as described in the BaseHostDataSource::get6.

Parameters
prefixIPv6 prefix for which the Host object is searched.
prefix_lenIPv6 prefix length.
targetThe host data source being a target of the operation.
Returns
Const Host object using a specified IPv6 prefix.

Definition at line 557 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, cache(), isc::dhcp::HOSTS_DBG_TRACE, isc::dhcp::hosts_logger, isc::dhcp::HOSTS_MGR_ALTERNATE_GET6_PREFIX, LOG_DEBUG, isc::dhcp::PRIMARY_SOURCE, and isc::asiolink::IOAddress::toText().

+ Here is the call graph for this function:

◆ get6() [3/6]

ConstHostPtr isc::dhcp::HostMgr::get6 ( const SubnetID & subnet_id,
const asiolink::IOAddress & addr ) const
virtual

The HostMgr::get6 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 706 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and get6().

+ Here is the call graph for this function:

◆ get6() [4/6]

ConstHostPtr isc::dhcp::HostMgr::get6 ( const SubnetID & subnet_id,
const asiolink::IOAddress & addr,
const HostMgrOperationTarget target ) const

Returns a host from specific subnet and reserved address.

Parameters
subnet_idsubnet identifier.
addrspecified address.
targetThe host data source being a target of the operation.
Returns
Const host object that has a reservation for specified address.

Definition at line 676 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, cache(), isc::dhcp::HOSTS_DBG_TRACE, isc::dhcp::hosts_logger, isc::dhcp::HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_ADDRESS6, LOG_DEBUG, isc::dhcp::PRIMARY_SOURCE, and isc::asiolink::IOAddress::toText().

+ Here is the call graph for this function:

◆ get6() [5/6]

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

The HostMgr::get6 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 667 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and get6().

+ Here is the call graph for this function:

◆ get6() [6/6]

ConstHostPtr isc::dhcp::HostMgr::get6 ( const SubnetID & subnet_id,
const Host::IdentifierType & identifier_type,
const uint8_t * identifier_begin,
const size_t identifier_len,
const HostMgrOperationTarget target ) const

Returns a host connected to the IPv6 subnet.

This method returns a host connected to the IPv6 subnet as described in the BaseHostDataSource::get6.

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

Definition at line 650 of file host_mgr.cc.

References cacheNegative(), get6Any(), and negative_caching_.

Referenced by isc::dhcp::AllocEngine::findGlobalReservation(), isc::dhcp::AllocEngine::findReservation(), get6(), get6(), and get6().

+ Here is the call graph for this function:

◆ get6Any() [1/2]

ConstHostPtr isc::dhcp::HostMgr::get6Any ( const SubnetID & subnet_id,
const Host::IdentifierType & identifier_type,
const uint8_t * identifier_begin,
const size_t identifier_len ) const
virtual

The HostMgr::get6Any compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Definition at line 641 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and get6Any().

+ Here is the call graph for this function:

◆ get6Any() [2/2]

ConstHostPtr isc::dhcp::HostMgr::get6Any ( const SubnetID & subnet_id,
const Host::IdentifierType & identifier_type,
const uint8_t * identifier_begin,
const size_t identifier_len,
const HostMgrOperationTarget target ) const

Returns any host connected to the IPv6 subnet.

This method returns a host connected to the IPv6 subnet as described in the BaseHostDataSource::get6 even when the reservation is marked as from negative caching. This allows to monitor negative caching.

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

Definition at line 590 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, cache(), isc::dhcp::Host::getIdentifierAsText(), isc::dhcp::HOSTS_DBG_RESULTS, isc::dhcp::HOSTS_DBG_TRACE, isc::dhcp::hosts_logger, isc::dhcp::HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_IDENTIFIER, isc::dhcp::HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_IDENTIFIER_HOST, isc::dhcp::HOSTS_MGR_ALTERNATE_GET6_SUBNET_ID_IDENTIFIER_NULL, LOG_DEBUG, and isc::dhcp::PRIMARY_SOURCE.

Referenced by get6(), and get6Any().

+ Here is the call graph for this function:

◆ getAll() [1/2]

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

The HostMgr::getAll compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 143 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and getAll().

+ Here is the call graph for this function:

◆ getAll() [2/2]

ConstHostCollection isc::dhcp::HostMgr::getAll ( const Host::IdentifierType & identifier_type,
const uint8_t * identifier_begin,
const size_t identifier_len,
const HostMgrOperationTarget target ) const

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

This method returns all Host objects representing reservations for a specified identifier as documented in the BaseHostDataSource::getAll.

It retrieves reservations from both primary and alternate host data source as a single collection of Host objects, i.e. if matching reservations are in both sources, all of them are returned. The reservations from the primary data source are placed before the reservations from the alternate source.

Parameters
identifier_typeIdentifier type.
identifier_beginPointer to a beginning of a buffer containing an identifier.
identifier_lenIdentifier length.
targetThe host data source being a target of the operation.
Returns
Collection of const Host objects.

Definition at line 123 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and isc::dhcp::PRIMARY_SOURCE.

Referenced by isc::dhcp::AllocEngine::findReservation(), isc::dhcp::AllocEngine::findReservation(), and getAll().

◆ getAll4() [1/6]

ConstHostCollection isc::dhcp::HostMgr::getAll4 ( const asiolink::IOAddress & address) const
virtual

The HostMgr::getAll4 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 396 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and getAll4().

+ Here is the call graph for this function:

◆ getAll4() [2/6]

ConstHostCollection isc::dhcp::HostMgr::getAll4 ( const asiolink::IOAddress & address,
const HostMgrOperationTarget target ) const

Returns a collection of hosts using the specified IPv4 address.

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

If matching reservations are both in the primary and the alternate data source, all of them are returned. The reservations from the primary data source are placed before the reservations from the alternate source.

Parameters
addressIPv4 address for which the Host object is searched.
targetThe host data source being a target of the operation.
Returns
Collection of const Host objects.

Definition at line 381 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and isc::dhcp::PRIMARY_SOURCE.

◆ getAll4() [3/6]

ConstHostCollection isc::dhcp::HostMgr::getAll4 ( const SubnetID & subnet_id) const
virtual

The HostMgr::getAll4 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 166 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and getAll4().

+ Here is the call graph for this function:

◆ getAll4() [4/6]

ConstHostCollection isc::dhcp::HostMgr::getAll4 ( const SubnetID & subnet_id,
const asiolink::IOAddress & address ) const
virtual

The HostMgr::getAll4 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 551 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and getAll4().

+ Here is the call graph for this function:

◆ getAll4() [5/6]

ConstHostCollection isc::dhcp::HostMgr::getAll4 ( const SubnetID & subnet_id,
const asiolink::IOAddress & address,
const HostMgrOperationTarget target ) const

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.
targetThe host data source being a target of the operation.
Returns
Collection of const Host objects.

Definition at line 528 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, isc::dhcp::HOSTS_DBG_TRACE, isc::dhcp::hosts_logger, isc::dhcp::HOSTS_MGR_ALTERNATE_GET_ALL_SUBNET_ID_ADDRESS4, LOG_DEBUG, isc::dhcp::PRIMARY_SOURCE, and isc::asiolink::IOAddress::toText().

+ Here is the call graph for this function:

◆ getAll4() [6/6]

ConstHostCollection isc::dhcp::HostMgr::getAll4 ( const SubnetID & subnet_id,
const HostMgrOperationTarget target ) const

Return all hosts in a DHCPv4 subnet.

This method returns all Host objects representing reservations in a specified subnet as documented in the BaseHostDataSource::getAll4

It retrieves reservations from both primary and alternate host data source as a single collection of Host objects, i.e. if matching reservations are in both sources, all of them are returned. The reservations from the primary data source are placed before the reservations from the alternate source.

Parameters
subnet_idSubnet identifier.
targetThe host data source being a target of the operation.
Returns
Collection of const Host objects.

Definition at line 151 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and isc::dhcp::PRIMARY_SOURCE.

Referenced by getAll4(), getAll4(), and getAll4().

◆ getAll6() [1/6]

ConstHostCollection isc::dhcp::HostMgr::getAll6 ( const asiolink::IOAddress & address) const
virtual

The HostMgr::getAll6 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 742 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and getAll6().

+ Here is the call graph for this function:

◆ getAll6() [2/6]

ConstHostCollection isc::dhcp::HostMgr::getAll6 ( const asiolink::IOAddress & address,
const HostMgrOperationTarget target ) const

Returns a collection of hosts using the specified IPv6 address/prefix.

This method may return multiple Host objects if they are connected to different subnets or if there are multiple hosts with the same IPv6 address/prefix.

If matching reservations are both in the primary and the alternate data source, all of them are returned. The reservations from the primary data source are placed before the reservations from the alternate source.

Parameters
addressIPv6 address for which the Host object is searched.
targetThe host data source being a target of the operation.
Returns
Collection of const Host objects.

Definition at line 747 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and isc::dhcp::PRIMARY_SOURCE.

◆ getAll6() [3/6]

ConstHostCollection isc::dhcp::HostMgr::getAll6 ( const SubnetID & subnet_id) const
virtual

The HostMgr::getAll6 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 186 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and getAll6().

+ Here is the call graph for this function:

◆ getAll6() [4/6]

ConstHostCollection isc::dhcp::HostMgr::getAll6 ( const SubnetID & subnet_id,
const asiolink::IOAddress & address ) const
virtual

The HostMgr::getAll6 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 736 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and getAll6().

+ Here is the call graph for this function:

◆ getAll6() [5/6]

ConstHostCollection isc::dhcp::HostMgr::getAll6 ( const SubnetID & subnet_id,
const asiolink::IOAddress & address,
const HostMgrOperationTarget target ) const

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.
targetThe host data source being a target of the operation.
Returns
Collection of const Host objects.

Definition at line 712 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, isc::dhcp::HOSTS_DBG_TRACE, isc::dhcp::hosts_logger, isc::dhcp::HOSTS_MGR_ALTERNATE_GET_ALL_SUBNET_ID_ADDRESS6, LOG_DEBUG, isc::dhcp::PRIMARY_SOURCE, and isc::asiolink::IOAddress::toText().

+ Here is the call graph for this function:

◆ getAll6() [6/6]

ConstHostCollection isc::dhcp::HostMgr::getAll6 ( const SubnetID & subnet_id,
const HostMgrOperationTarget target ) const

Return all hosts in a DHCPv6 subnet.

This method returns all Host objects representing reservations in a specified subnet as documented in the BaseHostDataSource::getAll6

It retrieves reservations from both primary and alternate host data source as a single collection of Host objects, i.e. if matching reservations are in both sources, all of them are returned. The reservations from the primary data source are placed before the reservations from the alternate source.

Parameters
subnet_idSubnet identifier.
targetThe host data source being a target of the operation.
Returns
Collection of const Host objects.

Definition at line 171 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and isc::dhcp::PRIMARY_SOURCE.

Referenced by getAll6(), getAll6(), and getAll6().

◆ getAllbyHostname() [1/2]

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

The HostMgr::getAllbyHostname compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 206 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and getAllbyHostname().

+ Here is the call graph for this function:

◆ getAllbyHostname() [2/2]

ConstHostCollection isc::dhcp::HostMgr::getAllbyHostname ( const std::string & hostname,
const HostMgrOperationTarget target ) const

Return all hosts with a hostname.

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

Parameters
hostnameThe lower case hostname.
targetThe host data source being a target of the operation.
Returns
Collection of const Host objects.

Definition at line 191 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and isc::dhcp::PRIMARY_SOURCE.

Referenced by getAllbyHostname().

◆ getAllbyHostname4() [1/2]

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

The HostMgr::getAllbyHostname4 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 229 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and getAllbyHostname4().

+ Here is the call graph for this function:

◆ getAllbyHostname4() [2/2]

ConstHostCollection isc::dhcp::HostMgr::getAllbyHostname4 ( const std::string & hostname,
const SubnetID & subnet_id,
const HostMgrOperationTarget target ) const

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.
targetThe host data source being a target of the operation.
Returns
Collection of const Host objects.

Definition at line 211 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and isc::dhcp::PRIMARY_SOURCE.

Referenced by getAllbyHostname4().

◆ getAllbyHostname6() [1/2]

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

The HostMgr::getAllbyHostname6 compatible with BaseHostDataSource interfaces.

Operates on all host sources.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 253 of file host_mgr.cc.

References isc::dhcp::ALL_SOURCES, and getAllbyHostname6().

+ Here is the call graph for this function:

◆ getAllbyHostname6() [2/2]

ConstHostCollection isc::dhcp::HostMgr::getAllbyHostname6 ( const std::string & hostname,
const SubnetID & subnet_id,
const HostMgrOperationTarget target ) const

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.
targetThe host data source being a target of the operation.
Returns
Collection of const Host objects.

Definition at line 235 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and isc::dhcp::PRIMARY_SOURCE.

Referenced by getAllbyHostname6().

◆ getDisableSingleQuery()

bool isc::dhcp::HostMgr::getDisableSingleQuery ( ) const
inline

Returns the disable single query flag.

Returns
the disable single query flag.

Definition at line 796 of file host_mgr.h.

References disable_single_query_.

Referenced by isc::dhcp::AllocEngine::findReservation(), and isc::dhcp::AllocEngine::findReservation().

◆ getHostDataSource()

HostDataSourcePtr isc::dhcp::HostMgr::getHostDataSource ( ) const

Returns the first host data source.

May return NULL if the host data source list is empty.

Returns
pointer to the first host data source (or NULL).

Definition at line 84 of file host_mgr.cc.

◆ getHostDataSourceList()

HostDataSourceList & isc::dhcp::HostMgr::getHostDataSourceList ( )
inline

Returns the host data source list.

Returns
reference to the host data source list.

Definition at line 770 of file host_mgr.h.

◆ getIPReservationsUnique()

bool isc::dhcp::HostMgr::getIPReservationsUnique ( ) const
inline

Returns the boolean flag indicating if the IP reservations must be unique or can be non-unique.

Returns
true if IP reservations must be unique or false if IP reservations can be non-unique.

Definition at line 831 of file host_mgr.h.

◆ getNegativeCaching()

bool isc::dhcp::HostMgr::getNegativeCaching ( ) const
inline

Returns the negative caching flag.

Returns
the negative caching flag.

Definition at line 783 of file host_mgr.h.

References negative_caching_.

◆ getPage4() [1/2]

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

Returns range of hosts in a DHCPv4 subnet.

This method returns a page of Host objects representing reservations in a specified subnet as documented in the BaseHostDataSource::getPage4

The typical usage of this method is as follows:

  • Get the first page of hosts by specifying zero index and id as the beginning of the range.
  • Index and last id of the returned range should be used as starting index and id for the next page in the subsequent call.
  • All returned hosts are from the same source so if the number of hosts returned is lower than the page size, it does not indicate that the last page has been retrieved.
  • If there are no hosts returned it indicates that the previous page was the last page.
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).

Implements isc::dhcp::BaseHostDataSource.

Definition at line 259 of file host_mgr.cc.

References getPage4().

Referenced by getPage4(), and getPage4().

+ Here is the call graph for this function:

◆ getPage4() [2/2]

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

Returns range of hosts.

This method returns a page of Host objects representing reservations as documented in the BaseHostDataSource::getPage4

The typical usage of this method is as follows:

  • Get the first page of hosts by specifying zero index and id as the beginning of the range.
  • Index and last id of the returned range should be used as starting index and id for the next page in the subsequent call.
  • All returned hosts are from the same source so if the number of hosts returned is lower than the page size, it does not indicate that the last page has been retrieved.
  • If there are no hosts returned it indicates that the previous page was the last page.
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).

Implements isc::dhcp::BaseHostDataSource.

Definition at line 321 of file host_mgr.cc.

References getPage4().

+ Here is the call graph for this function:

◆ getPage6() [1/2]

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

Returns range of hosts in a DHCPv6 subnet.

This method returns a page of Host objects representing reservations in a specified subnet as documented in the BaseHostDataSource::getPage6

The typical usage of this method is as follows:

  • Get the first page of hosts by specifying zero index and id as the beginning of the range.
  • Index and last id of the returned range should be used as starting index and id for the next page in the subsequent call.
  • All returned hosts are from the same source so if the number of hosts returned is lower than the page size, it does not indicate that the last page has been retrieved.
  • If there are no hosts returned it indicates that the previous page was the last page.
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).

Implements isc::dhcp::BaseHostDataSource.

Definition at line 290 of file host_mgr.cc.

References getPage6().

Referenced by getPage6(), and getPage6().

+ Here is the call graph for this function:

◆ getPage6() [2/2]

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

Returns range of hosts.

This method returns a page of Host objects representing reservations as documented in the BaseHostDataSource::getPage6

The typical usage of this method is as follows:

  • Get the first page of hosts by specifying zero index and id as the beginning of the range.
  • Index and last id of the returned range should be used as starting index and id for the next page in the subsequent call.
  • All returned hosts are from the same source so if the number of hosts returned is lower than the page size, it does not indicate that the last page has been retrieved.
  • If there are no hosts returned it indicates that the previous page was the last page.
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).

Implements isc::dhcp::BaseHostDataSource.

Definition at line 351 of file host_mgr.cc.

References getPage6().

+ Here is the call graph for this function:

◆ getType()

virtual std::string isc::dhcp::HostMgr::getType ( ) const
inlinevirtual

Return backend type.

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

Returns
Type of the backend.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 763 of file host_mgr.h.

◆ instance()

HostMgr & isc::dhcp::HostMgr::instance ( )
static

Returns a sole instance of the HostMgr.

This method should be used to retrieve an instance of the HostMgr to be used to gather/manage host reservations. It returns an instance of the HostMgr created by the create method. If such instance doesn't exist yet, it is created using the create method with the default value of the data access string, which configures the host manager to not use the alternate host data source.

Definition at line 114 of file host_mgr.cc.

References create().

Referenced by isc::dhcp::CfgDbAccess::createManagers(), isc::dhcp::CBControlDHCPv4::databaseConfigApply(), isc::dhcp::CBControlDHCPv6::databaseConfigApply(), isc::dhcp::AllocEngine::findGlobalReservation(), isc::dhcp::AllocEngine::findGlobalReservation(), isc::dhcp::AllocEngine::findReservation(), and isc::dhcp::AllocEngine::findReservation().

+ Here is the call graph for this function:

◆ setDisableSingleQuery()

void isc::dhcp::HostMgr::setDisableSingleQuery ( bool disable_single_query)
inline

Sets the disable single query flag.

Definition at line 802 of file host_mgr.h.

References disable_single_query_.

◆ setIPReservationsUnique()

bool isc::dhcp::HostMgr::setIPReservationsUnique ( const bool unique)
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.

Calling this function on HostMgr causes the manager to attempt to set this flag on all backends in use.

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.

Implements isc::dhcp::BaseHostDataSource.

Definition at line 958 of file host_mgr.cc.

References isc::dhcp::hosts_logger, isc::dhcp::HOSTS_MGR_NON_UNIQUE_IP_UNSUPPORTED, and LOG_WARN.

◆ setNegativeCaching()

void isc::dhcp::HostMgr::setNegativeCaching ( bool negative_caching)
inline

Sets the negative caching flag.

Definition at line 789 of file host_mgr.h.

References negative_caching_.

◆ update() [1/2]

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

The HostMgr::update with default operation target.

Operates on alternate host sources only.

Reimplemented from isc::dhcp::BaseHostDataSource.

Definition at line 922 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, and update().

+ Here is the call graph for this function:

◆ update() [2/2]

void isc::dhcp::HostMgr::update ( HostPtr const & host,
const HostMgrOperationTarget target )

Implements BaseHostDataSource::update() for alternate sources.

Attempts to update an existing host entry.

Parameters
hostthe host up to date with the requested changes
targetThe host data source being a target of the operation.

Definition at line 898 of file host_mgr.cc.

References isc::dhcp::ALTERNATE_SOURCES, cache(), isc_throw, and isc::dhcp::PRIMARY_SOURCE.

Referenced by update().

+ Here is the call graph for this function:

Member Data Documentation

◆ disable_single_query_

bool isc::dhcp::HostMgr::disable_single_query_
protected

The disable single query flag.

When true prevent the use of lookup methods returning a collection aka single queries when methods returning a host object are usable instead.

Definition at line 849 of file host_mgr.h.

Referenced by getDisableSingleQuery(), and setDisableSingleQuery().

◆ negative_caching_

bool isc::dhcp::HostMgr::negative_caching_
protected

The negative caching flag.

When true and the first backend is a cache negative answers are inserted in the cache. This works for get[46] for a subnet and an identifier.

Definition at line 842 of file host_mgr.h.

Referenced by cacheNegative(), get4(), get6(), getNegativeCaching(), and setNegativeCaching().


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