Kea  1.9.9-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...
 
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

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.

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

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

+ Here is the call graph for this function:

Member Function Documentation

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

References allocated_resources_.

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

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

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

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

Returns
Pointer to the host object.

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

+ Here is the call graph for this function:

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

+ Here is the call graph for this function:

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

+ Here is the call graph for this function:

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

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

References globalHost().

+ Here is the call graph for this function:

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

References allocated_resources_.

Member Data Documentation

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

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

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


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