Kea
1.9.9-git
|
Context information for the DHCPv6 leases allocation. More...
#include <alloc_engine.h>
Classes | |
struct | IAContext |
Parameters pertaining to individual IAs. More... | |
Public Member Functions | |
ClientContext6 () | |
Default constructor. More... | |
ClientContext6 (const Subnet6Ptr &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. More... | |
void | addAllocatedResource (const asiolink::IOAddress &prefix, const uint8_t prefix_len=128) |
Convenience method adding allocated prefix or address. More... | |
void | addHostIdentifier (const Host::IdentifierType &id_type, const std::vector< uint8_t > &identifier) |
Convenience function adding host identifier into host_identifiers_ list. More... | |
void | createIAContext () |
Creates new IA context. More... | |
ConstHostPtr | currentHost () const |
Returns host from the most preferred subnet. More... | |
IAContext & | currentIA () |
Returns IA specific context for the currently processed IA. 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... | |
bool | hasGlobalReservation (const IPv6Resrv &resv) const |
Determines if a global reservation exists. More... | |
bool | isAllocated (const asiolink::IOAddress &prefix, const uint8_t prefix_len=128) const |
Checks if specified address or prefix was allocated. More... | |
Public Attributes | |
std::vector< IAContext > | ias_ |
Container holding IA specific contexts. More... | |
Parameters pertaining to DHCPv6 message | |
Pkt6Ptr | query_ |
A pointer to the client's message. More... | |
bool | fake_allocation_ |
Indicates if this is a real or fake allocation. More... | |
Subnet6Ptr | subnet_ |
Subnet selected for the client by the server. More... | |
Subnet6Ptr | host_subnet_ |
Subnet from which host reservations should be retrieved. More... | |
DuidPtr | duid_ |
Client identifier. More... | |
HWAddrPtr | hwaddr_ |
Hardware/MAC address (if available, may be NULL) More... | |
IdentifierList | host_identifiers_ |
A list holding host identifiers extracted from a message received by the server. More... | |
std::map< SubnetID, ConstHostPtr > | hosts_ |
Holds a map of hosts belonging to the client within different subnets. More... | |
bool | fwd_dns_update_ |
A boolean value which indicates that server takes responsibility for the forward DNS Update for this lease (if true). More... | |
bool | rev_dns_update_ |
A boolean value which indicates that server takes responsibility for the reverse DNS Update for this lease (if true). More... | |
std::string | hostname_ |
Hostname. More... | |
hooks::CalloutHandlePtr | callout_handle_ |
Callout handle associated with the client's message. More... | |
ResourceContainer | allocated_resources_ |
Holds addresses and prefixes allocated for all IAs. More... | |
Lease6Collection | new_leases_ |
A collection of newly allocated leases. More... | |
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 459 of file alloc_engine.h.
isc::dhcp::AllocEngine::ClientContext6::ClientContext6 | ( | ) |
Default constructor.
Definition at line 458 of file alloc_engine.cc.
isc::dhcp::AllocEngine::ClientContext6::ClientContext6 | ( | const Subnet6Ptr & | 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 465 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 536 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 646 of file alloc_engine.h.
Referenced by ClientContext6(), and isc::dhcp::Dhcpv6Srv::initContext().
|
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 667 of file alloc_engine.h.
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 550 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::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 656 of file alloc_engine.h.
References createIAContext().
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::Dhcpv6Srv::assignIA_NA(), isc::dhcp::Dhcpv6Srv::assignIA_PD(), isc::dhcp::Dhcpv6Srv::createNameChangeRequests(), isc::dhcp::Dhcpv6Srv::extendIA_NA(), isc::dhcp::Dhcpv6Srv::extendIA_PD(), 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 582 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().
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 563 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 576 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 544 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 521 of file alloc_engine.h.
Referenced by addAllocatedResource(), isc::dhcp::Dhcpv6Srv::buildCfgOptionList(), isAllocated(), and isc::dhcp::Dhcpv6Srv::requiredClassify().
hooks::CalloutHandlePtr isc::dhcp::AllocEngine::ClientContext6::callout_handle_ |
Callout handle associated with the client's message.
Definition at line 518 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::initContext().
DuidPtr isc::dhcp::AllocEngine::ClientContext6::duid_ |
Client identifier.
Definition at line 485 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::Dhcpv6Srv::declineLeases(), isc::dhcp::Dhcpv6Srv::extendIA_PD(), isc::dhcp::Dhcpv6Srv::initContext(), isc::dhcp::Dhcpv6Srv::releaseLeases(), and isc::dhcp::AllocEngine::renewLeases6().
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 474 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::assignIA_NA(), isc::dhcp::Dhcpv6Srv::assignIA_PD(), isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), isc::dhcp::Dhcpv6Srv::processDhcp6Query(), 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 504 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::assignIA_NA(), isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), isc::dhcp::Dhcpv6Srv::extendIA_NA(), and isc::dhcp::Dhcpv6Srv::initContext().
IdentifierList isc::dhcp::AllocEngine::ClientContext6::host_identifiers_ |
A list holding host identifiers extracted from a message received by the server.
Definition at line 492 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::findGlobalReservation(), and isc::dhcp::AllocEngine::findReservation().
Subnet6Ptr 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 482 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 515 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 499 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), currentHost(), 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 488 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::initContext().
std::vector<IAContext> isc::dhcp::AllocEngine::ClientContext6::ias_ |
Container holding IA specific contexts.
Definition at line 616 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::processDhcp6Query().
Lease6Collection isc::dhcp::AllocEngine::ClientContext6::new_leases_ |
A collection of newly allocated leases.
Definition at line 524 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), isc::dhcp::Dhcpv6Srv::declineLeases(), isc::dhcp::Dhcpv6Srv::processDhcp6Query(), 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 467 of file alloc_engine.h.
Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::AllocEngine::findReservation(), isc::dhcp::Dhcpv6Srv::initContext(), isc::dhcp::Dhcpv6Srv::processConfirm(), isc::dhcp::Dhcpv6Srv::processDecline(), isc::dhcp::Dhcpv6Srv::processDhcp6Query(), isc::dhcp::Dhcpv6Srv::processInfRequest(), isc::dhcp::Dhcpv6Srv::processRebind(), isc::dhcp::Dhcpv6Srv::processRelease(), isc::dhcp::Dhcpv6Srv::processRenew(), isc::dhcp::Dhcpv6Srv::processRequest(), isc::dhcp::Dhcpv6Srv::processSolicit(), isc::dhcp::AllocEngine::renewLeases6(), 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 509 of file alloc_engine.h.
Referenced by isc::dhcp::Dhcpv6Srv::assignIA_NA(), isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), isc::dhcp::Dhcpv6Srv::extendIA_NA(), and isc::dhcp::Dhcpv6Srv::initContext().
Subnet6Ptr isc::dhcp::AllocEngine::ClientContext6::subnet_ |
Subnet selected for the client by the server.
Definition at line 477 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::extendIA_NA(), isc::dhcp::Dhcpv6Srv::extendIA_PD(), isc::dhcp::Dhcpv6Srv::extendLeases(), isc::dhcp::AllocEngine::findReservation(), getDdnsParams(), globalHost(), isc::dhcp::Dhcpv6Srv::initContext(), isc::dhcp::Dhcpv6Srv::processConfirm(), isc::dhcp::Dhcpv6Srv::processSolicit(), isc::dhcp::AllocEngine::renewLeases6(), isc::dhcp::Dhcpv6Srv::requiredClassify(), and isc::dhcp::AllocEngine::updateLease6ExtendedInfo().