Kea: isc::dhcp::AllocEngine::ClientContext4 Struct Reference

| Kea 3.2.0-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:
[legend]

## Public Member Functions
| ClientContext4 ()
| Default constructor.
| ClientContext4 (const ConstSubnet4Ptr &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, const uint32_t offer_lft=0)
| Constructor with parameters.
void | addHostIdentifier (const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier)
| Convenience function adding host identifier into host_identifiers_ list.
ConstHostPtr | currentHost () const
| Returns host for currently selected subnet.
DdnsParamsPtr | getDdnsParams ()
| Returns the set of DDNS behavioral parameters based on the selected subnet.
ConstHostPtr | globalHost () const
| Returns global host reservation if there is one.

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

## 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 1249 of file alloc_engine.h.

## Constructor & Destructor Documentation

## ◆ ClientContext4() [1/2]

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

Default constructor.

Definition at line 3847 of file alloc_engine.cc.

References callout_handle_, clientid_, conflicting_lease_, early_global_reservations_lookup_, fake_allocation_, fwd_dns_update_, host_identifiers_, hostname_, hosts_, hwaddr_, new_lease_, offer_lft_, old_lease_, query_, requested_address_, rev_dns_update_, subnet_, and unknown_requested_addr_.

## ◆ ClientContext4() [2/2]

isc::dhcp::AllocEngine::ClientContext4::ClientContext4 | ( | const ConstSubnet4Ptr & | 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,
|  | const uint32_t | offer_lft = 0 )

Constructor with parameters.

Parameters

  subnet | subnet the allocation should come from (mandatory)
  clientid | Client identifier (optional)
  hwaddr | Client's hardware address info (mandatory)
  requested_addr | A hint that the client provided (may be 0.0.0.0)
  fwd_dns_update | Indicates whether forward DNS update will be performed for the client (true) or not (false).
  rev_dns_update | Indicates whether reverse DNS update will be performed for the client (true) or not (false).
  hostname | A string carrying hostname to be used for DNS updates.
  fake_allocation | Is this real i.e. REQUEST (false) or just picking an address for DISCOVER that is not really allocated (true)
  offer_lft | When not zero, leases ARE allocated on DISCOVER and use this value as lease lifetime.

Definition at line 3859 of file alloc_engine.cc.

References addHostIdentifier(), callout_handle_, clientid_, early_global_reservations_lookup_, fake_allocation_, fwd_dns_update_, host_identifiers_, hostname_, hosts_, hwaddr_, isc::dhcp::Host::IDENT_HWADDR, new_lease_, offer_lft_, old_lease_, requested_address_, rev_dns_update_, subnet_, and unknown_requested_addr_.

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_type | Identifier type.
  identifier | Identifier value.

Definition at line 1345 of file alloc_engine.h.

References host_identifiers_.

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 3884 of file alloc_engine.cc.

References globalHost(), hosts_, and subnet_.

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 3908 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 3896 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 1283 of file alloc_engine.h.

Referenced by ClientContext4(), and ClientContext4().

## ◆ clientid_

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

Client identifier from the DHCP message.

Definition at line 1259 of file alloc_engine.h.

Referenced by ClientContext4(), and ClientContext4().

## ◆ 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 1314 of file alloc_engine.h.

Referenced by ClientContext4().

## ◆ 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 1253 of file alloc_engine.h.

Referenced by ClientContext4(), ClientContext4(), and 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 1290 of file alloc_engine.h.

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

## ◆ fwd_dns_update_

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

Perform forward DNS update.

Definition at line 1271 of file alloc_engine.h.

Referenced by ClientContext4(), and ClientContext4().

## ◆ 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 1324 of file alloc_engine.h.

Referenced by ClientContext4(), ClientContext4(), addHostIdentifier(), 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 1280 of file alloc_engine.h.

Referenced by ClientContext4(), and ClientContext4().

## ◆ 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 1307 of file alloc_engine.h.

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

## ◆ hwaddr_

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

HW address from the DHCP message.

Definition at line 1262 of file alloc_engine.h.

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

## ◆ new_lease_

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

A pointer to a newly allocated lease.

Definition at line 1300 of file alloc_engine.h.

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

## ◆ offer_lft_

uint32_t isc::dhcp::AllocEngine::ClientContext4::offer_lft_

If not zero, then we will allocate on DISCOVER for this amount of time.

Definition at line 1294 of file alloc_engine.h.

Referenced by ClientContext4(), and ClientContext4().

## ◆ old_lease_

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

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

Definition at line 1297 of file alloc_engine.h.

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

## ◆ 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 1320 of file alloc_engine.h.

Referenced by ClientContext4(), isc::dhcp::AllocEngine::allocateLease4(), isc::dhcp::AllocEngine::findReservation(), isc::dhcp::AllocEngine::getMinValidLft(), isc::dhcp::AllocEngine::getOfferLft(), 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 1268 of file alloc_engine.h.

Referenced by ClientContext4(), and ClientContext4().

## ◆ rev_dns_update_

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

Perform reverse DNS update.

Definition at line 1274 of file alloc_engine.h.

Referenced by ClientContext4(), and ClientContext4().

## ◆ subnet_

ConstSubnet4Ptr isc::dhcp::AllocEngine::ClientContext4::subnet_

Subnet selected for the client by the server.

Definition at line 1256 of file alloc_engine.h.

Referenced by ClientContext4(), ClientContext4(), isc::dhcp::AllocEngine::allocateLease4(), currentHost(), isc::dhcp::AllocEngine::findReservation(), getDdnsParams(), isc::dhcp::AllocEngine::getMinValidLft(), isc::dhcp::AllocEngine::getOfferLft(), isc::dhcp::AllocEngine::getValidLft(), globalHost(), and isc::dhcp::AllocEngine::updateLease4ExtendedInfo().

## ◆ 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 1328 of file alloc_engine.h.

Referenced by ClientContext4(), and ClientContext4().

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

- alloc_engine.h
- alloc_engine.cc