Kea 2.7.5
|
Context information for the DHCPv4 lease allocation. More...
#include <alloc_engine.h>
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. | |
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 1233 of file alloc_engine.h.
isc::dhcp::AllocEngine::ClientContext4::ClientContext4 | ( | ) |
Default constructor.
Definition at line 3614 of file alloc_engine.cc.
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.
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 3626 of file alloc_engine.cc.
References addHostIdentifier(), and isc::dhcp::Host::IDENT_HWADDR.
|
inline |
Convenience function adding host identifier into host_identifiers_ list.
id_type | Identifier type. |
identifier | Identifier value. |
Definition at line 1329 of file alloc_engine.h.
References host_identifiers_.
Referenced by ClientContext4().
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.
Definition at line 3651 of file alloc_engine.cc.
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.
Definition at line 3675 of file alloc_engine.cc.
References isc::dhcp::CfgMgr::instance().
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.
Definition at line 3663 of file alloc_engine.cc.
hooks::CalloutHandlePtr isc::dhcp::AllocEngine::ClientContext4::callout_handle_ |
Callout handle associated with the client's message.
Definition at line 1267 of file alloc_engine.h.
ClientIdPtr isc::dhcp::AllocEngine::ClientContext4::clientid_ |
Client identifier from the DHCP message.
Definition at line 1243 of file alloc_engine.h.
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 1298 of file alloc_engine.h.
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 1237 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::findReservation().
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 1274 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLease4(), and isc::dhcp::AllocEngine::getOfferLft().
bool isc::dhcp::AllocEngine::ClientContext4::fwd_dns_update_ |
Perform forward DNS update.
Definition at line 1255 of file alloc_engine.h.
IdentifierList isc::dhcp::AllocEngine::ClientContext4::host_identifiers_ |
A list holding host identifiers extracted from a message received by the server.
Definition at line 1308 of file alloc_engine.h.
Referenced by addHostIdentifier(), isc::dhcp::AllocEngine::findGlobalReservation(), and isc::dhcp::AllocEngine::findReservation().
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 1264 of file alloc_engine.h.
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 1291 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::findReservation().
HWAddrPtr isc::dhcp::AllocEngine::ClientContext4::hwaddr_ |
HW address from the DHCP message.
Definition at line 1246 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLease4().
Lease4Ptr isc::dhcp::AllocEngine::ClientContext4::new_lease_ |
A pointer to a newly allocated lease.
Definition at line 1284 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLease4().
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 1278 of file alloc_engine.h.
Lease4Ptr isc::dhcp::AllocEngine::ClientContext4::old_lease_ |
A pointer to an old lease that the client had before update.
Definition at line 1281 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLease4().
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 1304 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLease4(), isc::dhcp::AllocEngine::findReservation(), isc::dhcp::AllocEngine::getOfferLft(), isc::dhcp::AllocEngine::getValidLft(), and isc::dhcp::AllocEngine::updateLease4ExtendedInfo().
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 1252 of file alloc_engine.h.
bool isc::dhcp::AllocEngine::ClientContext4::rev_dns_update_ |
Perform reverse DNS update.
Definition at line 1258 of file alloc_engine.h.
ConstSubnet4Ptr isc::dhcp::AllocEngine::ClientContext4::subnet_ |
Subnet selected for the client by the server.
Definition at line 1240 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLease4(), isc::dhcp::AllocEngine::findReservation(), isc::dhcp::AllocEngine::getOfferLft(), isc::dhcp::AllocEngine::getValidLft(), and isc::dhcp::AllocEngine::updateLease4ExtendedInfo().
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 1312 of file alloc_engine.h.