Kea 2.7.5
|
Structure that holds a lease for IPv6 address and/or prefix. More...
#include <lease.h>
Public Types | |
enum | ExtendedInfoAction { ACTION_IGNORE , ACTION_DELETE , ACTION_UPDATE } |
Action on extended info tables. More... | |
Public Types inherited from isc::dhcp::Lease | |
enum | Type { TYPE_NA = 0 , TYPE_TA = 1 , TYPE_PD = 2 , TYPE_V4 = 3 } |
Type of lease or pool. More... | |
Public Member Functions | |
Lease6 () | |
Constructor. | |
Lease6 (Lease::Type type, const isc::asiolink::IOAddress &addr, DuidPtr duid, uint32_t iaid, uint32_t preferred, uint32_t valid, SubnetID subnet_id, const bool fqdn_fwd, const bool fqdn_rev, const std::string &hostname, const HWAddrPtr &hwaddr=HWAddrPtr(), uint8_t prefixlen=128) | |
Constructor, including FQDN data. | |
Lease6 (Lease::Type type, const isc::asiolink::IOAddress &addr, DuidPtr duid, uint32_t iaid, uint32_t preferred, uint32_t valid, SubnetID subnet_id, const HWAddrPtr &hwaddr=HWAddrPtr(), uint8_t prefixlen=128) | |
Constructor. | |
void | decline (uint32_t probation_period) |
Sets IPv6 lease to declined state. | |
const std::vector< uint8_t > & | getDuidVector () const |
Returns a reference to a vector representing a DUID. | |
virtual Lease::Type | getType () const |
Returns Lease type. | |
bool | operator!= (const Lease6 &other) const |
Compare two leases for inequality. | |
bool | operator== (const Lease6 &other) const |
Compare two leases for equality. | |
virtual isc::data::ElementPtr | toElement () const |
Return the JSON representation of a lease. | |
virtual std::string | toText () const |
Convert Lease to Printable Form. | |
Public Member Functions inherited from isc::dhcp::Lease | |
Lease (const isc::asiolink::IOAddress &addr, uint32_t valid_lft, SubnetID subnet_id, time_t cltt, const bool fqdn_fwd, const bool fqdn_rev, const std::string &hostname, const HWAddrPtr &hwaddr) | |
Constructor. | |
virtual | ~Lease () |
Destructor. | |
bool | expired () const |
returns true if the lease is expired | |
bool | stateExpiredReclaimed () const |
Indicates if the lease is in the "expired-reclaimed" state. | |
bool | stateDeclined () const |
Indicates if the lease is in the "declined" state. | |
bool | hasIdenticalFqdn (const Lease &other) const |
Returns true if the other lease has equal FQDN data. | |
const std::vector< uint8_t > & | getHWAddrVector () const |
Returns raw (as vector) hardware address. | |
int64_t | getExpirationTime () const |
Returns lease expiration time. | |
void | updateCurrentExpirationTime () |
Update lease current expiration time with new value, so that additional operations can be done without performing extra read from the database. | |
Public Member Functions inherited from isc::data::UserContext | |
void | contextToElement (data::ElementPtr map) const |
Merge unparse a user_context object. | |
data::ConstElementPtr | getContext () const |
Returns const pointer to the user context. | |
void | setContext (const data::ConstElementPtr &ctx) |
Sets user context. | |
Public Member Functions inherited from isc::data::CfgToElement | |
virtual | ~CfgToElement () |
Destructor. | |
Static Public Member Functions | |
static Lease6Ptr | fromElement (const data::ConstElementPtr &element) |
Returns pointer to the IPv6 lease created from JSON representation. | |
static std::string | statesToText (const uint32_t state) |
Returns name of the lease states specific to DHCPv6. | |
Static Public Member Functions inherited from isc::dhcp::Lease | |
static std::string | lifetimeToText (uint32_t lifetime) |
Print lifetime. | |
static Type | textToType (const std::string &text) |
Converts type name to the actual type. | |
static std::string | typeToText (Type type) |
returns text representation of a lease type | |
static std::string | basicStatesToText (const uint32_t state) |
Returns name(s) of the basic lease state(s). | |
static void | syncCurrentExpirationTime (const Lease &from, Lease &to) |
Sync lease current expiration time with new value from another lease, so that additional operations can be done without performing extra read from the database. | |
Static Public Member Functions inherited from isc::data::UserContext | |
static data::ElementPtr | toElement (data::ConstElementPtr map) |
Copy an Element map. | |
Public Attributes | |
DuidPtr | duid_ |
Client identifier. | |
ExtendedInfoAction | extended_info_action_ |
Record the action on extended info tables in the lease. | |
uint32_t | iaid_ |
Identity Association Identifier (IAID) | |
uint32_t | preferred_lft_ |
Preferred lifetime. | |
uint8_t | prefixlen_ |
IPv6 prefix length. | |
uint32_t | reuseable_preferred_lft_ |
Remaining preferred lifetime. | |
Lease::Type | type_ |
Lease type. | |
Public Attributes inherited from isc::dhcp::Lease | |
isc::asiolink::IOAddress | addr_ |
IPv4 ot IPv6 address. | |
uint32_t | valid_lft_ |
Valid lifetime. | |
uint32_t | current_valid_lft_ |
Current valid lifetime. | |
uint32_t | reuseable_valid_lft_ |
Remaining valid lifetime. | |
time_t | cltt_ |
Client last transmission time. | |
time_t | current_cltt_ |
Current client last transmission time. | |
SubnetID | subnet_id_ |
Subnet identifier. | |
uint32_t | pool_id_ |
The pool id. | |
std::string | hostname_ |
Client hostname. | |
bool | fqdn_fwd_ |
Forward zone updated? | |
bool | fqdn_rev_ |
Reverse zone updated? | |
HWAddrPtr | hwaddr_ |
Client's MAC/hardware address. | |
uint32_t | state_ |
Holds the lease state(s). | |
Additional Inherited Members | |
Static Public Attributes inherited from isc::dhcp::Lease | |
static const uint32_t | INFINITY_LFT = 0xffffffff |
Infinity (means static, i.e. never expire) | |
static const uint32_t | STATE_DEFAULT = 0 |
A lease in the default state. | |
static const uint32_t | STATE_DECLINED = 1 |
Declined lease. | |
static const uint32_t | STATE_EXPIRED_RECLAIMED = 2 |
Expired and reclaimed lease. | |
static const uint32_t | STATE_RELEASED = 3 |
Released lease held in the database for lease affinity. | |
Static Protected Member Functions inherited from isc::dhcp::Lease | |
static void | fromElementCommon (const LeasePtr &lease, const data::ConstElementPtr &element) |
Sets common (for v4 and v6) properties of the lease object. | |
Protected Attributes inherited from isc::data::UserContext | |
data::ConstElementPtr | user_context_ |
Pointer to the user context (may be NULL) | |
Structure that holds a lease for IPv6 address and/or prefix.
For performance reasons it is a simple structure, not a class. If we chose make it a class, all fields would have to made private and getters/setters would be required. As this is a critical part of the code that will be used extensively, direct access is warranted.
isc::dhcp::Lease6::Lease6 | ( | Lease::Type | type, |
const isc::asiolink::IOAddress & | addr, | ||
DuidPtr | duid, | ||
uint32_t | iaid, | ||
uint32_t | preferred, | ||
uint32_t | valid, | ||
SubnetID | subnet_id, | ||
const HWAddrPtr & | hwaddr = HWAddrPtr(), | ||
uint8_t | prefixlen = 128 ) |
Constructor.
type | Lease type. |
addr | Assigned address. |
duid | A pointer to an object representing DUID. |
iaid | IAID. |
preferred | Preferred lifetime. |
valid | Valid lifetime. |
subnet_id | A Subnet identifier. |
hwaddr | hardware/MAC address (optional) |
prefixlen | An address prefix length (optional, defaults to 128) |
Definition at line 453 of file lease.cc.
References isc::dhcp::Lease::cltt_, isc::dhcp::Lease::current_cltt_, isc_throw, and isc::dhcp::Lease::TYPE_PD.
isc::dhcp::Lease6::Lease6 | ( | Lease::Type | type, |
const isc::asiolink::IOAddress & | addr, | ||
DuidPtr | duid, | ||
uint32_t | iaid, | ||
uint32_t | preferred, | ||
uint32_t | valid, | ||
SubnetID | subnet_id, | ||
const bool | fqdn_fwd, | ||
const bool | fqdn_rev, | ||
const std::string & | hostname, | ||
const HWAddrPtr & | hwaddr = HWAddrPtr(), | ||
uint8_t | prefixlen = 128 ) |
Constructor, including FQDN data.
type | Lease type. |
addr | Assigned address. |
duid | A pointer to an object representing DUID. |
iaid | IAID. |
preferred | Preferred lifetime. |
valid | Valid lifetime. |
subnet_id | A Subnet identifier. |
fqdn_fwd | If true, forward DNS update is performed for a lease. |
fqdn_rev | If true, reverse DNS update is performed for a lease. |
hostname | FQDN of the client which gets the lease. |
hwaddr | hardware address (MAC), may be NULL |
prefixlen | An address prefix length (optional, defaults to 128) |
Definition at line 474 of file lease.cc.
References isc::dhcp::Lease::cltt_, isc::dhcp::Lease::current_cltt_, isc_throw, and isc::dhcp::Lease::TYPE_PD.
isc::dhcp::Lease6::Lease6 | ( | ) |
Constructor.
Initialize fields that don't have a default constructor.
Definition at line 499 of file lease.cc.
Referenced by fromElement().
|
virtual |
Sets IPv6 lease to declined state.
See Lease::decline for detailed description.
probation_period | valid lifetime will be set to this value |
Implements isc::dhcp::Lease.
Definition at line 522 of file lease.cc.
References isc::dhcp::Lease::cltt_, duid_, isc::dhcp::DUID::EMPTY(), isc::dhcp::Lease::fqdn_fwd_, isc::dhcp::Lease::fqdn_rev_, isc::dhcp::Lease::hostname_, isc::dhcp::Lease::hwaddr_, preferred_lft_, isc::dhcp::Lease::state_, isc::dhcp::Lease::STATE_DECLINED, and isc::dhcp::Lease::valid_lft_.
|
static |
Returns pointer to the IPv6 lease created from JSON representation.
element | pointer to the data element object to be parsed. |
Definition at line 662 of file lease.cc.
References Lease6(), isc::dhcp::Lease::fromElementCommon(), isc::dhcp::DUID::fromText(), isc::data::Element::integer, isc_throw, isc::data::Element::string, isc::dhcp::Lease::textToType(), and isc::dhcp::Lease::TYPE_PD.
const std::vector< uint8_t > & isc::dhcp::Lease6::getDuidVector | ( | ) | const |
Returns a reference to a vector representing a DUID.
Definition at line 512 of file lease.cc.
References duid_.
|
inlinevirtual |
|
inline |
bool isc::dhcp::Lease6::operator== | ( | const Lease6 & | other | ) | const |
Compare two leases for equality.
other | lease6 object with which to compare |
Definition at line 604 of file lease.cc.
References isc::dhcp::Lease::addr_, isc::dhcp::Lease::cltt_, isc::dhcp::Lease::current_cltt_, isc::dhcp::Lease::current_valid_lft_, duid_, isc::dhcp::Lease::fqdn_fwd_, isc::dhcp::Lease::fqdn_rev_, isc::data::UserContext::getContext(), isc::dhcp::Lease::hostname_, isc::dhcp::Lease::hwaddr_, iaid_, isc::util::nullOrEqualValues(), isc::dhcp::Lease::pool_id_, preferred_lft_, prefixlen_, reuseable_preferred_lft_, isc::dhcp::Lease::reuseable_valid_lft_, isc::dhcp::Lease::state_, isc::dhcp::Lease::subnet_id_, type_, and isc::dhcp::Lease::valid_lft_.
|
static |
Returns name of the lease states specific to DHCPv6.
state | Numeric value holding lease states. |
Definition at line 507 of file lease.cc.
References isc::dhcp::Lease::basicStatesToText().
Referenced by toText().
|
virtual |
Return the JSON representation of a lease.
Implements isc::data::CfgToElement.
Definition at line 628 of file lease.cc.
References isc::dhcp::Lease::addr_, isc::dhcp::Lease::cltt_, isc::data::UserContext::contextToElement(), isc::data::Element::create(), isc::data::Element::createMap(), duid_, isc::dhcp::Lease::fqdn_fwd_, isc::dhcp::Lease::fqdn_rev_, isc::dhcp::Lease::hostname_, isc::dhcp::Lease::hwaddr_, iaid_, isc::dhcp::Lease::pool_id_, preferred_lft_, prefixlen_, isc::dhcp::Lease::state_, isc::dhcp::Lease::subnet_id_, isc::asiolink::IOAddress::toText(), type_, isc::dhcp::Lease::TYPE_PD, isc::dhcp::Lease::typeToText(), and isc::dhcp::Lease::valid_lft_.
|
virtual |
Convert Lease to Printable Form.
Implements isc::dhcp::Lease.
Definition at line 535 of file lease.cc.
References isc::dhcp::Lease::addr_, isc::dhcp::Lease::cltt_, duid_, isc::data::UserContext::getContext(), isc::dhcp::Lease::hwaddr_, iaid_, isc::dhcp::Lease::lifetimeToText(), isc::dhcp::Lease::pool_id_, preferred_lft_, prefixlen_, isc::dhcp::Lease::state_, statesToText(), isc::dhcp::Lease::subnet_id_, type_, isc::dhcp::Lease::typeToText(), and isc::dhcp::Lease::valid_lft_.
DuidPtr isc::dhcp::Lease6::duid_ |
Client identifier.
Definition at line 536 of file lease.h.
Referenced by decline(), getDuidVector(), operator==(), toElement(), and toText().
ExtendedInfoAction isc::dhcp::Lease6::extended_info_action_ |
uint32_t isc::dhcp::Lease6::iaid_ |
Identity Association Identifier (IAID)
DHCPv6 stores all addresses and prefixes in IA containers (IA_NA, IA_TA, IA_PD). All containers may appear more than once in a message. To differentiate between them, the IAID field is present
Definition at line 533 of file lease.h.
Referenced by operator==(), toElement(), and toText().
uint32_t isc::dhcp::Lease6::preferred_lft_ |
Preferred lifetime.
This parameter specifies the preferred lifetime since the lease was assigned or renewed (cltt), expressed in seconds.
Definition at line 542 of file lease.h.
Referenced by decline(), operator==(), toElement(), and toText().
uint8_t isc::dhcp::Lease6::prefixlen_ |
IPv6 prefix length.
This is used only for prefix delegations and is ignored otherwise.
Definition at line 526 of file lease.h.
Referenced by operator==(), toElement(), and toText().
uint32_t isc::dhcp::Lease6::reuseable_preferred_lft_ |
Remaining preferred lifetime.
Expressed as number of seconds since current time, also preferred lifetime - age where age is old cltt - new cltt. This parameter is used only when reuseable_valid_lft_ is not zero, i.e. when the lease can be reused.
Definition at line 550 of file lease.h.
Referenced by operator==().
Lease::Type isc::dhcp::Lease6::type_ |
Lease type.
One of normal address, temporary address, or prefix.
Definition at line 521 of file lease.h.
Referenced by getType(), operator==(), toElement(), and toText().