Kea  2.1.7-git
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...
 

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...
 
IAContextcurrentIA ()
 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< IAContextias_
 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...
 
bool early_global_reservations_lookup_
 Indicates if early global reservation is enabled. 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, ConstHostPtrhosts_
 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...
 

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

Constructor & Destructor Documentation

◆ ClientContext6() [1/2]

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

Default constructor.

Definition at line 458 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 466 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 538 of file alloc_engine.cc.

References allocated_resources_, and isAllocated().

Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::AllocEngine::ClientContext6::IAContext::isNewResource(), and isc::dhcp::AllocEngine::renewLeases6().

+ Here is the call graph for this function:

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

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

Referenced by isc::dhcp::Dhcpv6Srv::assignIA_NA(), isc::dhcp::Dhcpv6Srv::assignIA_PD(), 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 552 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(), isc::dhcp::Dhcpv6Srv::requiredClassify(), and isc::dhcp::Dhcpv6Srv::setReservedClientClasses().

+ Here is the call graph for this function:

◆ currentIA()

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

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

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::instance(), and subnet_.

Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::Dhcpv6Srv::createNameChangeRequests(), isc::dhcp::Dhcpv6Srv::processClientFqdn(), and isc::dhcp::Dhcpv6Srv::requiredClassify().

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

References host_subnet_, hosts_, and subnet_.

Referenced by isc::dhcp::AllocEngine::allocateLeases6(), 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 578 of file alloc_engine.cc.

References globalHost().

Referenced by isc::dhcp::AllocEngine::allocateLeases6(), and isc::dhcp::AllocEngine::renewLeases6().

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

References allocated_resources_.

Referenced by addAllocatedResource(), and isc::dhcp::AllocEngine::allocateLeases6().

Member Data Documentation

◆ allocated_resources_

ResourceContainer isc::dhcp::AllocEngine::ClientContext6::allocated_resources_

Holds addresses and prefixes allocated for all IAs.

Definition at line 526 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_

◆ 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 479 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 474 of file alloc_engine.h.

Referenced by isc::dhcp::AllocEngine::allocateLeases6(), isc::dhcp::Dhcpv6Srv::assignIA_NA(), isc::dhcp::Dhcpv6Srv::assignIA_PD(), isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange(), isc::dhcp::AllocEngine::getLifetimes6(), isc::dhcp::Dhcpv6Srv::processSolicit(), and isc::dhcp::AllocEngine::renewLeases6().

◆ fwd_dns_update_

bool isc::dhcp::AllocEngine::ClientContext6::fwd_dns_update_

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

Referenced by 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 487 of file alloc_engine.h.

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

◆ hostname_

std::string isc::dhcp::AllocEngine::ClientContext6::hostname_

◆ 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 504 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_

◆ ias_

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

Container holding IA specific contexts.

Definition at line 621 of file alloc_engine.h.

◆ new_leases_

◆ query_

◆ rev_dns_update_

bool isc::dhcp::AllocEngine::ClientContext6::rev_dns_update_

◆ subnet_


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