Kea  2.1.7-git
isc::dhcp::Pool6 Class Reference

Pool information for IPv6 addresses and prefixes. More...

#include <pool.h>

+ Inheritance diagram for isc::dhcp::Pool6:

Public Member Functions

 Pool6 (Lease::Type type, const isc::asiolink::IOAddress &first, const isc::asiolink::IOAddress &last)
 the constructor for Pool6 "min-max" style definition More...
 
 Pool6 (Lease::Type type, const isc::asiolink::IOAddress &prefix, uint8_t prefix_len, uint8_t delegated_len=128)
 the constructor for Pool6 "prefix/len" style definition More...
 
 Pool6 (const asiolink::IOAddress &prefix, const uint8_t prefix_len, const uint8_t delegated_len, const asiolink::IOAddress &excluded_prefix, const uint8_t excluded_prefix_len)
 Constructor for DHCPv6 prefix pool with an excluded prefix. More...
 
uint8_t getLength () const
 returns delegated prefix length More...
 
Option6PDExcludePtr getPrefixExcludeOption () const
 Returns instance of the pool specific Prefix Exclude option. More...
 
Lease::Type getType () const
 returns pool type More...
 
virtual data::ElementPtr toElement () const
 Unparse a Pool6 object. More...
 
virtual std::string toText () const
 returns textual representation of the pool More...
 
- Public Member Functions inherited from isc::dhcp::Pool
virtual ~Pool ()
 virtual destructor More...
 
void allowClientClass (const ClientClass &class_name)
 Sets the supported class to class class_name. More...
 
bool clientSupported (const ClientClasses &client_classes) const
 Checks whether this pool supports client that belongs to specified classes. More...
 
uint64_t getCapacity () const
 Returns the number of all leases in this pool. More...
 
CfgOptionPtr getCfgOption ()
 Returns pointer to the option data configuration for this pool. More...
 
ConstCfgOptionPtr getCfgOption () const
 Returns const pointer to the option data configuration for this pool. More...
 
const ClientClassgetClientClass () const
 returns the client class More...
 
const isc::asiolink::IOAddressgetFirstAddress () const
 Returns the first address in a pool. More...
 
uint32_t getId () const
 returns Pool-id More...
 
const isc::asiolink::IOAddressgetLastAddress () const
 Returns the last address in a pool. More...
 
isc::asiolink::IOAddress getLastAllocated () const
 returns the last address that was tried from this pool More...
 
IPRangePermutationPtr getPermutation () const
 Returns pointer to the permutation associated with the pool. More...
 
const ClientClassesgetRequiredClasses () const
 Returns classes which are required to be evaluated. More...
 
Lease::Type getType () const
 Returns pool type (v4, v6 non-temporary, v6 temp, v6 prefix) More...
 
bool inRange (const isc::asiolink::IOAddress &addr) const
 Checks if a given address is in the range. More...
 
bool isLastAllocatedValid () const
 checks if the last address is valid More...
 
void requireClientClass (const ClientClass &class_name)
 Adds class class_name to classes required to be evaluated. More...
 
void resetLastAllocated ()
 resets the last address to invalid More...
 
void setLastAllocated (const isc::asiolink::IOAddress &addr)
 sets the last address that was tried from this pool More...
 
- Public Member Functions inherited from isc::data::UserContext
void contextToElement (data::ElementPtr map) const
 Merge unparse a user_context object. More...
 
data::ConstElementPtr getContext () const
 Returns const pointer to the user context. More...
 
void setContext (const data::ConstElementPtr &ctx)
 Sets user context. More...
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor. More...
 

Static Public Member Functions

static Pool6Ptr create (Lease::Type type, const isc::asiolink::IOAddress &first, const isc::asiolink::IOAddress &last)
 Factory function for creating an instance of the Pool6. More...
 
static Pool6Ptr create (Lease::Type type, const isc::asiolink::IOAddress &prefix, uint8_t prefix_len, uint8_t delegated_len=128)
 Factory function for creating an instance of the Pool6. More...
 
static Pool6Ptr create (const asiolink::IOAddress &prefix, const uint8_t prefix_len, const uint8_t delegated_len, const asiolink::IOAddress &excluded_prefix, const uint8_t excluded_prefix_len)
 Factory function for creating an instance of the Pool6. More...
 
- Static Public Member Functions inherited from isc::data::UserContext
static data::ElementPtr toElement (data::ConstElementPtr map)
 Copy an Element map. More...
 

Additional Inherited Members

- Protected Member Functions inherited from isc::dhcp::Pool
 Pool (Lease::Type type, const isc::asiolink::IOAddress &first, const isc::asiolink::IOAddress &last)
 protected constructor More...
 
- Static Protected Member Functions inherited from isc::dhcp::Pool
static uint32_t getNextID ()
 returns the next unique Pool-ID More...
 
- Protected Attributes inherited from isc::dhcp::Pool
uint64_t capacity_
 Stores number of possible leases. More...
 
CfgOptionPtr cfg_option_
 Pointer to the option data configuration for this pool. More...
 
ClientClass client_class_
 Optional definition of a client class. More...
 
isc::asiolink::IOAddress first_
 The first address in a pool. More...
 
uint32_t id_
 pool-id More...
 
isc::asiolink::IOAddress last_
 The last address in a pool. More...
 
isc::asiolink::IOAddress last_allocated_
 Last allocated address See isc::dhcp::Subnet::last_allocated_ia_ Initialized and reset to first. More...
 
bool last_allocated_valid_
 Status of last allocated address. More...
 
IPRangePermutationPtr permutation_
 Pointer to the permutation object. More...
 
ClientClasses required_classes_
 Required classes. More...
 
Lease::Type type_
 defines a lease type that will be served from this pool More...
 
data::ConstElementPtr user_context_
 Pointer to the user context (may be NULL) More...
 
- Protected Attributes inherited from isc::data::UserContext
data::ConstElementPtr user_context_
 Pointer to the user context (may be NULL) More...
 

Detailed Description

Pool information for IPv6 addresses and prefixes.

It holds information about pool6, i.e. a range of IPv6 address space that is configured for DHCP allocation.

Definition at line 321 of file pool.h.

Constructor & Destructor Documentation

◆ Pool6() [1/3]

isc::dhcp::Pool6::Pool6 ( Lease::Type  type,
const isc::asiolink::IOAddress first,
const isc::asiolink::IOAddress last 
)

the constructor for Pool6 "min-max" style definition

Exceptions
BadValueif PD is define (PD can be only prefix/len)
Parameters
typetype of the pool (IA or TA)
firstthe first address in a pool
lastthe last address in a pool

Definition at line 156 of file pool.cc.

References isc::asiolink::addrsInRange(), isc::dhcp::Pool::capacity_, isc_throw, isc::asiolink::IOAddress::isV6(), isc::dhcp::Lease::TYPE_NA, isc::dhcp::Lease::TYPE_PD, and isc::dhcp::Lease::TYPE_TA.

+ Here is the call graph for this function:

◆ Pool6() [2/3]

isc::dhcp::Pool6::Pool6 ( Lease::Type  type,
const isc::asiolink::IOAddress prefix,
uint8_t  prefix_len,
uint8_t  delegated_len = 128 
)

the constructor for Pool6 "prefix/len" style definition

For addressed, this is just a prefix/len definition. For prefixes, there is one extra additional parameter delegated_len. It specifies a size of delegated prefixes that the pool will be split into. For example pool 2001:db8::/56, delegated_len=64 means that there is a pool 2001:db8::/56. It will be split into 256 prefixes of length /64, e.g. 2001:db8:0:1::/64, 2001:db8:0:2::/64 etc.

Naming convention: A smaller prefix length yields a shorter prefix which describes a larger set of addresses. A larger length yields a longer prefix which describes a smaller set of addresses.

Obviously, prefix_len must define shorter or equal prefix length than delegated_len, so prefix_len <= delegated_len. Note that it is slightly confusing: bigger (larger) prefix actually has smaller prefix length, e.g. /56 is a bigger prefix than /64, but has shorter (smaller) prefix length.

Exceptions
BadValueif delegated_len is defined for non-PD types or when delegated_len < prefix_len
Parameters
typetype of the pool (IA, TA or PD)
prefixspecifies prefix of the pool
prefix_lenspecifies prefix length of the pool
delegated_lenspecifies length of the delegated prefixes

Definition at line 198 of file pool.cc.

References isc::asiolink::IOAddress::IPV6_ZERO_ADDRESS().

+ Here is the call graph for this function:

◆ Pool6() [3/3]

isc::dhcp::Pool6::Pool6 ( const asiolink::IOAddress prefix,
const uint8_t  prefix_len,
const uint8_t  delegated_len,
const asiolink::IOAddress excluded_prefix,
const uint8_t  excluded_prefix_len 
)

Constructor for DHCPv6 prefix pool with an excluded prefix.

If excluded_prefix is equal to '::' and the excluded_prefix_len is equal to 0, the excluded prefix is assumed to be unspecified for the pool. In this case, the server will not send the Prefix Exclude option to a client.

Parameters
prefixspecified a prefix of the pool.
prefix_lenspecifies prefix length of the pool.
delegated_lenspecifies length of the delegated prefixes.
excluded_prefixspecifies an excluded prefix as per RFC6603.
excluded_prefix_lenspecifies length of an excluded prefix.
Todo:
Check that the prefixes actually match. Theoretically, a user could specify a prefix which sets insignificant bits. We should clear insignificant bits based on the prefix length but this should be considered a part of the IOAddress class, perhaps and requires a bit of work (mainly in terms of testing).

Definition at line 207 of file pool.cc.

References isc_throw, isc::asiolink::IOAddress::isV6(), isc::asiolink::IOAddress::isV6Zero(), and isc::dhcp::Lease::TYPE_PD.

+ Here is the call graph for this function:

Member Function Documentation

◆ create() [1/3]

Pool6Ptr isc::dhcp::Pool6::create ( Lease::Type  type,
const isc::asiolink::IOAddress first,
const isc::asiolink::IOAddress last 
)
static

Factory function for creating an instance of the Pool6.

This function should be used to create an instance of the pool within a hooks library in cases when the library may be unloaded before the object is destroyed. This ensures that the ownership of the object by the Kea process is retained.

Parameters
typetype of the pool (IA or TA)
firstthe first address in a pool
lastthe last address in a pool
Returns
Pointer to the Pool6 instance.

Definition at line 260 of file pool.cc.

◆ create() [2/3]

Pool6Ptr isc::dhcp::Pool6::create ( Lease::Type  type,
const isc::asiolink::IOAddress prefix,
uint8_t  prefix_len,
uint8_t  delegated_len = 128 
)
static

Factory function for creating an instance of the Pool6.

This function should be used to create an instance of the pool within a hooks library in cases when the library may be unloaded before the object is destroyed. This ensures that the ownership of the object by the Kea process is retained.

Parameters
typetype of the pool (IA, TA or PD)
prefixspecifies prefix of the pool
prefix_lenspecifies prefix length of the pool
delegated_lenspecifies length of the delegated prefixes
Returns
Pointer to the Pool6 instance.

Definition at line 265 of file pool.cc.

◆ create() [3/3]

Pool6Ptr isc::dhcp::Pool6::create ( const asiolink::IOAddress prefix,
const uint8_t  prefix_len,
const uint8_t  delegated_len,
const asiolink::IOAddress excluded_prefix,
const uint8_t  excluded_prefix_len 
)
static

Factory function for creating an instance of the Pool6.

If excluded_prefix is equal to '::' and the excluded_prefix_len is equal to 0, the excluded prefix is assumed to be unspecified for the pool. In this case, the server will not send the Prefix Exclude option to a client.

Parameters
prefixspecifies a prefix of the pool.
prefix_lenspecifies prefix length of the pool.
delegated_lenspecifies length of the delegated prefixes.
excluded_prefixspecifies an excluded prefix as per RFC6603.
excluded_prefix_lenspecifies length of an excluded prefix.
Returns
Pointer to the Pool6 instance.

Definition at line 271 of file pool.cc.

References isc::dhcp::Pool::capacity_, isc_throw, isc::asiolink::IOAddress::isV6(), isc::dhcp::Pool::last_, isc::asiolink::lastAddrInPrefix(), isc::asiolink::prefixesInRange(), isc::dhcp::Lease::TYPE_NA, and isc::dhcp::Lease::TYPE_TA.

+ Here is the call graph for this function:

◆ getLength()

uint8_t isc::dhcp::Pool6::getLength ( ) const
inline

returns delegated prefix length

This may be useful for "prefix/len" style definition for addresses, but is mostly useful for prefix pools.

Returns
prefix length (1-128)

Definition at line 447 of file pool.h.

Referenced by toElement().

◆ getPrefixExcludeOption()

Option6PDExcludePtr isc::dhcp::Pool6::getPrefixExcludeOption ( ) const
inline

Returns instance of the pool specific Prefix Exclude option.

Returns
An instance of the Prefix Exclude option (RFC 6603) or NULL if such option hasn't been specified for the pool.

Definition at line 455 of file pool.h.

References isc::dhcp::Pool::toElement(), and isc::dhcp::Pool::toText().

Referenced by isc::dhcp::Dhcpv6Srv::assignIA_PD(), isc::dhcp::Dhcpv6Srv::extendIA_PD(), and toElement().

+ Here is the call graph for this function:

◆ getType()

Lease::Type isc::dhcp::Pool6::getType ( ) const
inline

returns pool type

Returns
pool type

Definition at line 438 of file pool.h.

References isc::dhcp::Pool::type_.

Referenced by toElement().

◆ toElement()

data::ElementPtr isc::dhcp::Pool6::toElement ( ) const
virtual

◆ toText()

std::string isc::dhcp::Pool6::toText ( ) const
virtual

returns textual representation of the pool

Returns
textual representation

Reimplemented from isc::dhcp::Pool.

Definition at line 410 of file pool.cc.

References isc::dhcp::Pool::first_, isc::dhcp::Pool::last_, isc::dhcp::Pool::type_, and isc::dhcp::Lease::typeToText().

+ Here is the call graph for this function:

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