Kea  2.1.7-git
isc::dhcp::AllocEngine::ClientContext4 Struct Reference

Context information for the DHCPv4 lease allocation. More...

#include <alloc_engine.h>

+ Inheritance diagram for isc::dhcp::AllocEngine::ClientContext4:

Public Member Functions

 ClientContext4 ()
 Default constructor. More...
 
 ClientContext4 (const Subnet4Ptr &subnet, const ClientIdPtr &clientid, const HWAddrPtr &hwaddr, const asiolink::IOAddress &requested_addr, const bool fwd_dns_update, const bool rev_dns_update, const std::string &hostname, const bool fake_allocation)
 Constructor with parameters. More...
 
void addHostIdentifier (const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier)
 Convenience function adding host identifier into host_identifiers_ list. More...
 
ConstHostPtr currentHost () const
 Returns host for currently selected subnet. More...
 
DdnsParamsPtr getDdnsParams ()
 Returns the set of DDNS behavioral parameters based on the selected subnet. More...
 
ConstHostPtr globalHost () const
 Returns global host reservation if there is one. More...
 

Public Attributes

hooks::CalloutHandlePtr callout_handle_
 Callout handle associated with the client's message. More...
 
ClientIdPtr clientid_
 Client identifier from the DHCP message. More...
 
Lease4Ptr conflicting_lease_
 A pointer to the object representing a lease in conflict. More...
 
bool early_global_reservations_lookup_
 Indicates if early global reservation is enabled. More...
 
bool fake_allocation_
 Indicates if this is a real or fake allocation. More...
 
bool fwd_dns_update_
 Perform forward DNS update. More...
 
IdentifierList host_identifiers_
 A list holding host identifiers extracted from a message received by the server. More...
 
std::string hostname_
 Hostname. More...
 
std::map< SubnetID, ConstHostPtrhosts_
 Holds a map of hosts belonging to the client within different subnets. More...
 
HWAddrPtr hwaddr_
 HW address from the DHCP message. More...
 
Lease4Ptr new_lease_
 A pointer to a newly allocated lease. More...
 
Lease4Ptr old_lease_
 A pointer to an old lease that the client had before update. More...
 
Pkt4Ptr query_
 A pointer to the client's message. More...
 
asiolink::IOAddress requested_address_
 An address that the client desires. More...
 
bool rev_dns_update_
 Perform reverse DNS update. More...
 
Subnet4Ptr subnet_
 Subnet selected for the client by the server. More...
 
bool unknown_requested_addr_
 True when the address DHCPREQUEST'ed by client is not within a dynamic pool the server knows about. More...
 

Detailed Description

Context information for the DHCPv4 lease allocation.

This structure holds a set of information provided by the DHCPv4 server to the allocation engine. In particular, it holds the client identifying information, such as HW address or client identifier. It also holds the information about the subnet that the client is connected to.

This structure is also used to pass some information from the allocation engine back to the server, i.e. the old lease which the client had before the allocation.

This structure is meant to be extended in the future, if more information should be passed to the allocation engine. Note that the big advantage of using the context structure to pass information to the allocation engine methods is that adding new information doesn't modify the API of the allocation engine.

Definition at line 1380 of file alloc_engine.h.

Constructor & Destructor Documentation

◆ ClientContext4() [1/2]

isc::dhcp::AllocEngine::ClientContext4::ClientContext4 ( )

Default constructor.

Definition at line 3429 of file alloc_engine.cc.

◆ ClientContext4() [2/2]

isc::dhcp::AllocEngine::ClientContext4::ClientContext4 ( const Subnet4Ptr subnet,
const ClientIdPtr clientid,
const HWAddrPtr hwaddr,
const asiolink::IOAddress requested_addr,
const bool  fwd_dns_update,
const bool  rev_dns_update,
const std::string &  hostname,
const bool  fake_allocation 
)

Constructor with parameters.

Parameters
subnetsubnet the allocation should come from (mandatory)
clientidClient identifier (optional)
hwaddrClient's hardware address info (mandatory)
requested_addrA hint that the client provided (may be 0.0.0.0)
fwd_dns_updateIndicates whether forward DNS update will be performed for the client (true) or not (false).
rev_dns_updateIndicates whether reverse DNS update will be performed for the client (true) or not (false).
hostnameA string carrying hostname to be used for DNS updates.
fake_allocationIs this real i.e. REQUEST (false) or just picking an address for DISCOVER that is not really allocated (true)

Definition at line 3440 of file alloc_engine.cc.

References addHostIdentifier(), and isc::dhcp::Host::IDENT_HWADDR.

+ Here is the call graph for this function:

Member Function Documentation

◆ addHostIdentifier()

void isc::dhcp::AllocEngine::ClientContext4::addHostIdentifier ( const Host::IdentifierType id_type,
const std::vector< uint8_t > &  identifier 
)
inline

Convenience function adding host identifier into host_identifiers_ list.

Parameters
id_typeIdentifier type.
identifierIdentifier value.

Definition at line 1472 of file alloc_engine.h.

Referenced by ClientContext4().

◆ currentHost()

ConstHostPtr isc::dhcp::AllocEngine::ClientContext4::currentHost ( ) const

Returns host for currently selected subnet.

If there is no such host and global reservations are enabled returns the global host.

Returns
Pointer to the host object.

Definition at line 3464 of file alloc_engine.cc.

References globalHost(), hosts_, and subnet_.

Referenced by isc::dhcp::AllocEngine::findGlobalReservation().

+ Here is the call graph for this function:

◆ getDdnsParams()

DdnsParamsPtr isc::dhcp::AllocEngine::ClientContext4::getDdnsParams ( )

Returns the set of DDNS behavioral parameters based on the selected subnet.

If there is no selected subnet (i.e. subnet_ is empty), the returned set will contain default values.

Returns
pointer to a DdnsParams instance

Definition at line 3488 of file alloc_engine.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), and subnet_.

+ Here is the call graph for this function:

◆ globalHost()

ConstHostPtr isc::dhcp::AllocEngine::ClientContext4::globalHost ( ) const

Returns global host reservation if there is one.

If the current subnet's reservations-global is true and there is a global host (i.e. reservation belonging to the global subnet), return it. Otherwise return an empty pointer.

Returns
Pointer to the host object.

Definition at line 3476 of file alloc_engine.cc.

References hosts_, and subnet_.

Referenced by currentHost().

Member Data Documentation

◆ callout_handle_

hooks::CalloutHandlePtr isc::dhcp::AllocEngine::ClientContext4::callout_handle_

Callout handle associated with the client's message.

Definition at line 1414 of file alloc_engine.h.

Referenced by isc::dhcp::AllocEngine::getValidLft().

◆ clientid_

ClientIdPtr isc::dhcp::AllocEngine::ClientContext4::clientid_

◆ conflicting_lease_

Lease4Ptr isc::dhcp::AllocEngine::ClientContext4::conflicting_lease_

A pointer to the object representing a lease in conflict.

This pointer is set by some of the allocation methods when the lease can't be allocated because there is another lease which is in conflict with this allocation.

Definition at line 1441 of file alloc_engine.h.

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

◆ early_global_reservations_lookup_

bool isc::dhcp::AllocEngine::ClientContext4::early_global_reservations_lookup_

Indicates if early global reservation is enabled.

This caches the early-global-reservations-lookup value.

Definition at line 1384 of file alloc_engine.h.

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

◆ fake_allocation_

bool isc::dhcp::AllocEngine::ClientContext4::fake_allocation_

Indicates if this is a real or fake allocation.

The real allocation is when the allocation engine is supposed to make an update in a lease database: create new lease, or update existing lease.

Definition at line 1421 of file alloc_engine.h.

Referenced by isc::dhcp::AllocEngine::allocateLease4(), and isc::dhcp::AllocEngine::getValidLft().

◆ fwd_dns_update_

bool isc::dhcp::AllocEngine::ClientContext4::fwd_dns_update_

Perform forward DNS update.

Definition at line 1402 of file alloc_engine.h.

Referenced by isc::dhcp::AllocEngine::getValidLft().

◆ host_identifiers_

IdentifierList isc::dhcp::AllocEngine::ClientContext4::host_identifiers_

A list holding host identifiers extracted from a message received by the server.

Definition at line 1451 of file alloc_engine.h.

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

◆ hostname_

std::string isc::dhcp::AllocEngine::ClientContext4::hostname_

Hostname.

The server retrieves the hostname from the Client FQDN option, Hostname option or the host reservation record for the client.

Definition at line 1411 of file alloc_engine.h.

Referenced by isc::dhcp::AllocEngine::getValidLft().

◆ hosts_

std::map<SubnetID, ConstHostPtr> isc::dhcp::AllocEngine::ClientContext4::hosts_

Holds a map of hosts belonging to the client within different subnets.

Multiple hosts may appear when the client belongs to a shared network.

Definition at line 1434 of file alloc_engine.h.

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

◆ hwaddr_

HWAddrPtr isc::dhcp::AllocEngine::ClientContext4::hwaddr_

◆ new_lease_

Lease4Ptr isc::dhcp::AllocEngine::ClientContext4::new_lease_

A pointer to a newly allocated lease.

Definition at line 1427 of file alloc_engine.h.

Referenced by isc::dhcp::AllocEngine::allocateLease4().

◆ old_lease_

Lease4Ptr isc::dhcp::AllocEngine::ClientContext4::old_lease_

A pointer to an old lease that the client had before update.

Definition at line 1424 of file alloc_engine.h.

Referenced by isc::dhcp::AllocEngine::allocateLease4(), isc::dhcp::AllocEngine::findGlobalReservation(), and isc::dhcp::AllocEngine::getValidLft().

◆ query_

Pkt4Ptr isc::dhcp::AllocEngine::ClientContext4::query_

A pointer to the client's message.

This is used in logging to retrieve the client's and the transaction identification information.

Definition at line 1447 of file alloc_engine.h.

Referenced by isc::dhcp::AllocEngine::allocateLease4(), isc::dhcp::AllocEngine::deleteExpiredReclaimedLeases4(), isc::dhcp::AllocEngine::findGlobalReservation(), isc::dhcp::AllocEngine::findReservation(), isc::dhcp::AllocEngine::getValidLft(), and isc::dhcp::AllocEngine::updateLease4ExtendedInfo().

◆ requested_address_

asiolink::IOAddress isc::dhcp::AllocEngine::ClientContext4::requested_address_

An address that the client desires.

If this address is set to 0 it indicates that this address is unspecified.

Definition at line 1399 of file alloc_engine.h.

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

◆ rev_dns_update_

bool isc::dhcp::AllocEngine::ClientContext4::rev_dns_update_

Perform reverse DNS update.

Definition at line 1405 of file alloc_engine.h.

Referenced by isc::dhcp::AllocEngine::getValidLft().

◆ subnet_

◆ unknown_requested_addr_

bool isc::dhcp::AllocEngine::ClientContext4::unknown_requested_addr_

True when the address DHCPREQUEST'ed by client is not within a dynamic pool the server knows about.

Definition at line 1455 of file alloc_engine.h.

Referenced by isc::dhcp::AllocEngine::findGlobalReservation().


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