Kea 2.7.6
|
Context information for the DHCPv6 leases allocation. More...
#include <alloc_engine.h>
Classes | |
struct | IAContext |
Parameters pertaining to individual IAs. More... | |
Parameters pertaining to DHCPv6 message | |
Pkt6Ptr | query_ |
A pointer to the client's message. | |
bool | fake_allocation_ |
Indicates if this is a real or fake allocation. | |
bool | early_global_reservations_lookup_ |
Indicates if early global reservation is enabled. | |
ConstSubnet6Ptr | subnet_ |
Subnet selected for the client by the server. | |
ConstSubnet6Ptr | host_subnet_ |
Subnet from which host reservations should be retrieved. | |
DuidPtr | duid_ |
Client identifier. | |
HWAddrPtr | hwaddr_ |
Hardware/MAC address (if available, may be NULL) | |
IdentifierList | host_identifiers_ |
A list holding host identifiers extracted from a message received by the server. | |
std::map< SubnetID, ConstHostPtr > | hosts_ |
Holds a map of hosts belonging to the client within different subnets. | |
bool | fwd_dns_update_ |
A boolean value which indicates that server takes responsibility for the forward DNS Update for this lease (if true). | |
bool | rev_dns_update_ |
A boolean value which indicates that server takes responsibility for the reverse DNS Update for this lease (if true). | |
std::string | hostname_ |
Hostname. | |
hooks::CalloutHandlePtr | callout_handle_ |
Callout handle associated with the client's message. | |
ResourceContainer | allocated_resources_ |
Holds addresses and prefixes allocated for all IAs. | |
Lease6Collection | new_leases_ |
A collection of newly allocated leases. | |
std::vector< IAContext > | ias_ |
Container holding IA specific contexts. | |
DdnsParamsPtr | getDdnsParams () |
Returns the set of DDNS behavioral parameters based on the selected subnet. | |
void | addAllocatedResource (const asiolink::IOAddress &prefix, const uint8_t prefix_len=128) |
Convenience method adding allocated prefix or address. | |
bool | isAllocated (const asiolink::IOAddress &prefix, const uint8_t prefix_len=128) const |
Checks if specified address or prefix was allocated. | |
void | addHostIdentifier (const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier) |
Convenience function adding host identifier into host_identifiers_ list. | |
IAContext & | currentIA () |
Returns IA specific context for the currently processed IA. | |
std::vector< IAContext > & | getIAContexts () |
void | createIAContext () |
Creates new IA context. | |
ConstHostPtr | currentHost () const |
Returns host from the most preferred subnet. | |
ConstHostPtr | globalHost () const |
Returns global host reservation if there is one. | |
bool | hasGlobalReservation (const IPv6Resrv &resv) const |
Determines if a global reservation exists. | |
ClientContext6 () | |
Default constructor. | |
ClientContext6 (const ConstSubnet6Ptr &subnet, const DuidPtr &duid, const bool fwd_dns, const bool rev_dns, const std::string &hostname, const bool fake_allocation, const Pkt6Ptr &query, const hooks::CalloutHandlePtr &callout_handle=hooks::CalloutHandlePtr()) | |
Constructor with parameters. | |
Context information for the DHCPv6 leases allocation.
This structure holds a set of information provided by the DHCPv6 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 leases which the client had before the allocation.
This structure is expected to be common for a single client, even if multiple IAs are used. Some of the fields will need to be updated for every call (there's a separate call to the allocation engine for each IA option).
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 218 of file alloc_engine.h.
isc::dhcp::AllocEngine::ClientContext6::ClientContext6 | ( | ) |
Default constructor.
Definition at line 196 of file alloc_engine.cc.
isc::dhcp::AllocEngine::ClientContext6::ClientContext6 | ( | const ConstSubnet6Ptr & | subnet, |
const DuidPtr & | duid, | ||
const bool | fwd_dns, | ||
const bool | rev_dns, | ||
const std::string & | hostname, | ||
const bool | fake_allocation, | ||
const Pkt6Ptr & | query, | ||
const hooks::CalloutHandlePtr & | callout_handle = hooks::CalloutHandlePtr() ) |
Constructor with parameters.
Note that several less frequently used parameters (callout_handle, old_leases, host) fields are not set. They should be set explicitly, if needed.
subnet | subnet the allocation should come from |
duid | Client's DUID |
fwd_dns | A boolean value which indicates that server takes responsibility for the forward DNS Update for this lease (if true). |
rev_dns | A boolean value which indicates that server takes responsibility for the reverse DNS Update for this lease (if true). |
hostname | A fully qualified domain-name of the client. |
fake_allocation | is this real i.e. REQUEST (false) or just picking an address for SOLICIT that is not really allocated (true) |
query | Pointer to the DHCPv6 message being processed. |
callout_handle | Callout handle associated with a client's message |
Definition at line 204 of file alloc_engine.cc.
References addHostIdentifier(), and isc::dhcp::Host::IDENT_DUID.
void isc::dhcp::AllocEngine::ClientContext6::addAllocatedResource | ( | const asiolink::IOAddress & | prefix, |
const uint8_t | prefix_len = 128 ) |
Convenience method adding allocated prefix or address.
prefix | Prefix or address. |
prefix_len | Prefix length. Default is 128 for addresses. |
Definition at line 275 of file alloc_engine.cc.
References allocated_resources_.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), and isc::dhcp::AllocEngine::renewLeases6().
|
inline |
Convenience function adding host identifier into host_identifiers_ list.
id_type | Identifier type. |
identifier | Identifier value. |
Definition at line 413 of file alloc_engine.h.
References host_identifiers_.
Referenced by ClientContext6(), and isc::dhcp::Dhcpv6Srv::setHostIdentifiers().
|
inline |
Creates new IA context.
This method should be invoked prior to processing a next IA included in the client's message.
Definition at line 438 of file alloc_engine.h.
References ias_.
Referenced by isc::dhcp::Dhcpv6Srv::assignIA_NA(), isc::dhcp::Dhcpv6Srv::assignIA_PD(), currentIA(), isc::dhcp::Dhcpv6Srv::extendIA_NA(), and isc::dhcp::Dhcpv6Srv::extendIA_PD().
ConstHostPtr isc::dhcp::AllocEngine::ClientContext6::currentHost | ( | ) | const |
Returns host from the most preferred subnet.
If there is no such host and global reservations are enabled returns the global host.
Definition at line 290 of file alloc_engine.cc.
References globalHost(), host_subnet_, hosts_, and subnet_.
Referenced by isc::dhcp::Dhcpv6Srv::buildCfgOptionList(), isc::dhcp::Dhcpv6Srv::conditionallySetReservedClientClasses(), isc::dhcp::Dhcpv6Srv::getPDExclude(), isc::dhcp::Dhcpv6Srv::initContext(), isc::dhcp::Dhcpv6Srv::processClientFqdn(), and isc::dhcp::Dhcpv6Srv::setReservedClientClasses().
|
inline |
Returns IA specific context for the currently processed IA.
If IA specific context doesn't exist, it is created.
Definition at line 423 of file alloc_engine.h.
References createIAContext(), and ias_.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::Dhcpv6Srv::assignIA_NA(), isc::dhcp::Dhcpv6Srv::assignIA_PD(), isc::dhcp::Dhcpv6Srv::extendIA_NA(), isc::dhcp::Dhcpv6Srv::extendIA_PD(), isc::dhcp::AllocEngine::getLifetimes6(), isc::dhcp::Dhcpv6Srv::releaseLeases(), and isc::dhcp::AllocEngine::renewLeases6().
DdnsParamsPtr isc::dhcp::AllocEngine::ClientContext6::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 322 of file alloc_engine.cc.
References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), and subnet_.
Referenced by isc::dhcp::Dhcpv6Srv::createNameChangeRequests(), and isc::dhcp::Dhcpv6Srv::processClientFqdn().
|
inline |
Definition at line 430 of file alloc_engine.h.
References ias_.
Referenced by isc::dhcp::Dhcpv6Srv::createNameChangeRequests().
ConstHostPtr isc::dhcp::AllocEngine::ClientContext6::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 303 of file alloc_engine.cc.
References host_subnet_, hosts_, and subnet_.
Referenced by currentHost(), hasGlobalReservation(), and isc::dhcp::Dhcpv6Srv::initContext().
bool isc::dhcp::AllocEngine::ClientContext6::hasGlobalReservation | ( | const IPv6Resrv & | resv | ) | const |
Determines if a global reservation exists.
Definition at line 316 of file alloc_engine.cc.
References globalHost().
bool isc::dhcp::AllocEngine::ClientContext6::isAllocated | ( | const asiolink::IOAddress & | prefix, |
const uint8_t | prefix_len = 128 ) const |
Checks if specified address or prefix was allocated.
prefix | Prefix or address. |
prefix_len | Prefix length. Default is 128 for addresses. |
Definition at line 283 of file alloc_engine.cc.
References allocated_resources_.
ResourceContainer isc::dhcp::AllocEngine::ClientContext6::allocated_resources_ |
Holds addresses and prefixes allocated for all IAs.
Definition at line 285 of file alloc_engine.h.
Referenced by addAllocatedResource(), isc::dhcp::Dhcpv6Srv::buildCfgOptionList(), isc::dhcp::Dhcpv6Srv::evaluateAdditionalClasses(), and isAllocated().
hooks::CalloutHandlePtr isc::dhcp::AllocEngine::ClientContext6::callout_handle_ |
Callout handle associated with the client's message.
Definition at line 282 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::initContext().
DuidPtr isc::dhcp::AllocEngine::ClientContext6::duid_ |
Client identifier.
Definition at line 249 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::Dhcpv6Srv::declineLeases(), isc::dhcp::Dhcpv6Srv::extendIA_PD(), isc::dhcp::Dhcpv6Srv::initContext0(), isc::dhcp::Dhcpv6Srv::releaseLeases(), isc::dhcp::AllocEngine::renewLeases6(), and isc::dhcp::Dhcpv6Srv::setHostIdentifiers().
bool isc::dhcp::AllocEngine::ClientContext6::early_global_reservations_lookup_ |
Indicates if early global reservation is enabled.
This caches the early-global-reservations-lookup value.
Definition at line 238 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::earlyGHRLookup(), isc::dhcp::AllocEngine::findReservation(), and isc::dhcp::Dhcpv6Srv::initContext().
bool isc::dhcp::AllocEngine::ClientContext6::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 233 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::assignIA_NA(), isc::dhcp::Dhcpv6Srv::assignIA_PD(), isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), isc::dhcp::Dhcpv6Srv::processLocalizedQuery6(), and isc::dhcp::Dhcpv6Srv::processSolicit().
bool isc::dhcp::AllocEngine::ClientContext6::fwd_dns_update_ |
A boolean value which indicates that server takes responsibility for the forward DNS Update for this lease (if true).
Definition at line 268 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), isc::dhcp::Dhcpv6Srv::extendIA_NA(), isc::dhcp::Dhcpv6Srv::initContext(), and isc::dhcp::Dhcpv6Srv::processClientFqdn().
IdentifierList isc::dhcp::AllocEngine::ClientContext6::host_identifiers_ |
A list holding host identifiers extracted from a message received by the server.
Definition at line 256 of file alloc_engine.h.
Referenced by addHostIdentifier(), isc::dhcp::AllocEngine::findGlobalReservation(), and isc::dhcp::AllocEngine::findReservation().
ConstSubnet6Ptr isc::dhcp::AllocEngine::ClientContext6::host_subnet_ |
Subnet from which host reservations should be retrieved.
It can be NULL, in which case subnet_
value is used.
Definition at line 246 of file alloc_engine.h.
Referenced by currentHost(), and globalHost().
std::string isc::dhcp::AllocEngine::ClientContext6::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 279 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), isc::dhcp::Dhcpv6Srv::extendIA_NA(), isc::dhcp::Dhcpv6Srv::initContext(), and isc::dhcp::Dhcpv6Srv::processClientFqdn().
std::map<SubnetID, ConstHostPtr> isc::dhcp::AllocEngine::ClientContext6::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 263 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), currentHost(), isc::dhcp::Dhcpv6Srv::earlyGHRLookup(), isc::dhcp::AllocEngine::findReservation(), globalHost(), isc::dhcp::Dhcpv6Srv::initContext(), and isc::dhcp::AllocEngine::renewLeases6().
HWAddrPtr isc::dhcp::AllocEngine::ClientContext6::hwaddr_ |
Hardware/MAC address (if available, may be NULL)
Definition at line 252 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::initContext0(), and isc::dhcp::Dhcpv6Srv::setHostIdentifiers().
std::vector<IAContext> isc::dhcp::AllocEngine::ClientContext6::ias_ |
Container holding IA specific contexts.
Definition at line 383 of file alloc_engine.h.
Referenced by createIAContext(), currentIA(), getIAContexts(), and isc::dhcp::Dhcpv6Srv::processLocalizedQuery6().
Lease6Collection isc::dhcp::AllocEngine::ClientContext6::new_leases_ |
A collection of newly allocated leases.
Definition at line 288 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), isc::dhcp::Dhcpv6Srv::declineLeases(), isc::dhcp::Dhcpv6Srv::processLocalizedQuery6(), and isc::dhcp::AllocEngine::renewLeases6().
Pkt6Ptr isc::dhcp::AllocEngine::ClientContext6::query_ |
A pointer to the client's message.
This is used exclusively for hook purposes.
Definition at line 226 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::AllocEngine::findReservation(), isc::dhcp::AllocEngine::getLifetimes6(), isc::dhcp::Dhcpv6Srv::initContext(), isc::dhcp::Dhcpv6Srv::initContext0(), isc::dhcp::Dhcpv6Srv::processConfirm(), isc::dhcp::Dhcpv6Srv::processDecline(), isc::dhcp::Dhcpv6Srv::processInfRequest(), isc::dhcp::Dhcpv6Srv::processLocalizedQuery6(), isc::dhcp::Dhcpv6Srv::processRebind(), isc::dhcp::Dhcpv6Srv::processRelease(), isc::dhcp::Dhcpv6Srv::processRenew(), isc::dhcp::Dhcpv6Srv::processRequest(), isc::dhcp::Dhcpv6Srv::processSolicit(), isc::dhcp::AllocEngine::renewLeases6(), isc::dhcp::Dhcpv6Srv::setHostIdentifiers(), and isc::dhcp::AllocEngine::updateLease6ExtendedInfo().
bool isc::dhcp::AllocEngine::ClientContext6::rev_dns_update_ |
A boolean value which indicates that server takes responsibility for the reverse DNS Update for this lease (if true).
Definition at line 273 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), isc::dhcp::Dhcpv6Srv::extendIA_NA(), isc::dhcp::Dhcpv6Srv::initContext(), and isc::dhcp::Dhcpv6Srv::processClientFqdn().
ConstSubnet6Ptr isc::dhcp::AllocEngine::ClientContext6::subnet_ |
Subnet selected for the client by the server.
Definition at line 241 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::Dhcpv6Srv::appendRequestedVendorOptions(), isc::dhcp::Dhcpv6Srv::assignIA_NA(), isc::dhcp::Dhcpv6Srv::assignIA_PD(), isc::dhcp::Dhcpv6Srv::assignLeases(), isc::dhcp::Dhcpv6Srv::buildCfgOptionList(), isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), isc::dhcp::Dhcpv6Srv::conditionallySetReservedClientClasses(), currentHost(), isc::dhcp::Dhcpv6Srv::evaluateAdditionalClasses(), isc::dhcp::Dhcpv6Srv::extendIA_NA(), isc::dhcp::Dhcpv6Srv::extendIA_PD(), isc::dhcp::Dhcpv6Srv::extendLeases(), isc::dhcp::AllocEngine::findReservation(), getDdnsParams(), isc::dhcp::AllocEngine::getLifetimes6(), isc::dhcp::Dhcpv6Srv::getPDExclude(), globalHost(), isc::dhcp::Dhcpv6Srv::initContext(), isc::dhcp::Dhcpv6Srv::processClientFqdn(), isc::dhcp::Dhcpv6Srv::processConfirm(), isc::dhcp::Dhcpv6Srv::processDhcp6Query(), isc::dhcp::Dhcpv6Srv::processLocalizedQuery6(), isc::dhcp::Dhcpv6Srv::processLocalizedQuery6AndSendResponse(), isc::dhcp::Dhcpv6Srv::processSolicit(), isc::dhcp::AllocEngine::renewLeases6(), and isc::dhcp::AllocEngine::updateLease6ExtendedInfo().