Kea 2.5.8
isc::dhcp::AllocEngine::ClientContext6 Struct Reference

Context information for the DHCPv6 leases allocation. More...

#include <alloc_engine.h>

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

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.
 
Subnet6Ptr subnet_
 Subnet selected for the client by the server.
 
Subnet6Ptr 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, ConstHostPtrhosts_
 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< IAContextias_
 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.
 
IAContextcurrentIA ()
 Returns IA specific context for the currently processed IA.
 
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 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ClientContext6() [1/2]

isc::dhcp::AllocEngine::ClientContext6::ClientContext6 ( )

Default constructor.

Definition at line 196 of file alloc_engine.cc.

◆ ClientContext6() [2/2]

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.

Parameters
subnetsubnet the allocation should come from
duidClient's DUID
fwd_dnsA boolean value which indicates that server takes responsibility for the forward DNS Update for this lease (if true).
rev_dnsA boolean value which indicates that server takes responsibility for the reverse DNS Update for this lease (if true).
hostnameA fully qualified domain-name of the client.
fake_allocationis this real i.e. REQUEST (false) or just picking an address for SOLICIT that is not really allocated (true)
queryPointer to the DHCPv6 message being processed.
callout_handleCallout handle associated with a client's message

Definition at line 204 of file alloc_engine.cc.

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addAllocatedResource()

void isc::dhcp::AllocEngine::ClientContext6::addAllocatedResource ( const asiolink::IOAddress prefix,
const uint8_t  prefix_len = 128 
)

Convenience method adding allocated prefix or address.

Parameters
prefixPrefix or address.
prefix_lenPrefix 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().

◆ addHostIdentifier()

void isc::dhcp::AllocEngine::ClientContext6::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 410 of file alloc_engine.h.

References host_identifiers_.

Referenced by ClientContext6(), and isc::dhcp::Dhcpv6Srv::setHostIdentifiers().

◆ createIAContext()

void isc::dhcp::AllocEngine::ClientContext6::createIAContext ( )
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 431 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().

◆ currentHost()

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.

Returns
Pointer to the host object.

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::initContext(), isc::dhcp::Dhcpv6Srv::processClientFqdn(), and isc::dhcp::Dhcpv6Srv::setReservedClientClasses().

+ Here is the call graph for this function:

◆ currentIA()

IAContext & isc::dhcp::AllocEngine::ClientContext6::currentIA ( )
inline

Returns IA specific context for the currently processed IA.

If IA specific context doesn't exist, it is created.

Returns
Reference to IA specific context.

Definition at line 420 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::createNameChangeRequests(), isc::dhcp::Dhcpv6Srv::extendIA_NA(), isc::dhcp::Dhcpv6Srv::extendIA_PD(), isc::dhcp::AllocEngine::getLifetimes6(), isc::dhcp::Dhcpv6Srv::releaseLeases(), and isc::dhcp::AllocEngine::renewLeases6().

+ Here is the call graph for this function:

◆ getDdnsParams()

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.

Returns
pointer to a DdnsParams instance

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().

+ Here is the call graph for this function:

◆ globalHost()

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.

Returns
Pointer to the host object.

Definition at line 303 of file alloc_engine.cc.

References host_subnet_, hosts_, and subnet_.

Referenced by currentHost(), hasGlobalReservation(), and isc::dhcp::Dhcpv6Srv::initContext().

◆ hasGlobalReservation()

bool isc::dhcp::AllocEngine::ClientContext6::hasGlobalReservation ( const IPv6Resrv resv) const

Determines if a global reservation exists.

Returns
true if there current subnet's reservations-global is true and there is global host containing the given lease reservation, false otherwise

Definition at line 316 of file alloc_engine.cc.

References globalHost().

+ Here is the call graph for this function:

◆ isAllocated()

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.

Parameters
prefixPrefix or address.
prefix_lenPrefix length. Default is 128 for addresses.

Definition at line 283 of file alloc_engine.cc.

References allocated_resources_.

Member Data Documentation

◆ 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(), isAllocated(), and isc::dhcp::Dhcpv6Srv::requiredClassify().

◆ callout_handle_

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().

◆ duid_

◆ early_global_reservations_lookup_

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().

◆ fake_allocation_

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().

◆ fwd_dns_update_

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().

◆ host_identifiers_

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().

◆ host_subnet_

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

Referenced by currentHost(), and globalHost().

◆ hostname_

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().

◆ hosts_

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().

◆ hwaddr_

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().

◆ ias_

std::vector<IAContext> isc::dhcp::AllocEngine::ClientContext6::ias_

Container holding IA specific contexts.

Definition at line 380 of file alloc_engine.h.

Referenced by createIAContext(), currentIA(), and isc::dhcp::Dhcpv6Srv::processLocalizedQuery6().

◆ new_leases_

◆ query_

◆ rev_dns_update_

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().

◆ subnet_


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