![]() |
Kea 2.2.0
|
Structure that holds a lease for IPv6 address and/or prefix. More...
#include <lease.h>
Inheritance diagram for isc::dhcp::Lease6:Public Member Functions | |
| Lease6 () | |
| Constructor. More... | |
| 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. More... | |
| 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. More... | |
| void | decline (uint32_t probation_period) |
| Sets IPv6 lease to declined state. More... | |
| const std::vector< uint8_t > & | getDuidVector () const |
| Returns a reference to a vector representing a DUID. More... | |
| virtual Lease::Type | getType () const |
| Returns Lease type. More... | |
| bool | operator!= (const Lease6 &other) const |
| Compare two leases for inequality. More... | |
| bool | operator== (const Lease6 &other) const |
| Compare two leases for equality. More... | |
| virtual isc::data::ElementPtr | toElement () const |
| Return the JSON representation of a lease. More... | |
| virtual std::string | toText () const |
| Convert Lease to Printable Form. More... | |
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. More... | |
| virtual | ~Lease () |
| Destructor. More... | |
| bool | expired () const |
| returns true if the lease is expired More... | |
| bool | stateExpiredReclaimed () const |
| Indicates if the lease is in the "expired-reclaimed" state. More... | |
| bool | stateDeclined () const |
| Indicates if the lease is in the "declined" state. More... | |
| bool | hasIdenticalFqdn (const Lease &other) const |
| Returns true if the other lease has equal FQDN data. More... | |
| const std::vector< uint8_t > & | getHWAddrVector () const |
| Returns raw (as vector) hardware address. More... | |
| int64_t | getExpirationTime () const |
| Returns lease expiration time. More... | |
| void | updateCurrentExpirationTime () |
| Update lease current expiration time with new value, so that additional operations can be done without performing extra read from the database. 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... | |
| virtual isc::data::ElementPtr | toElement () const =0 |
| Unparse a configuration object. More... | |
Static Public Member Functions | |
| static Lease6Ptr | fromElement (const data::ConstElementPtr &element) |
| Returns pointer to the IPv6 lease created from JSON representation. More... | |
| static std::string | statesToText (const uint32_t state) |
| Returns name of the lease states specific to DHCPv6. More... | |
Static Public Member Functions inherited from isc::dhcp::Lease | |
| static std::string | lifetimeToText (uint32_t lifetime) |
| Print lifetime. More... | |
| static Type | textToType (const std::string &text) |
| Converts type name to the actual type. More... | |
| static std::string | typeToText (Type type) |
| returns text representation of a lease type More... | |
| static std::string | basicStatesToText (const uint32_t state) |
| Returns name(s) of the basic lease state(s). More... | |
| 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. More... | |
Static Public Member Functions inherited from isc::data::UserContext | |
| static data::ElementPtr | toElement (data::ConstElementPtr map) |
| Copy an Element map. More... | |
Public Attributes | |
| DuidPtr | duid_ |
| Client identifier. More... | |
| uint32_t | iaid_ |
| Identity Association Identifier (IAID) More... | |
| uint32_t | preferred_lft_ |
| Preferred lifetime. More... | |
| uint8_t | prefixlen_ |
| IPv6 prefix length. More... | |
| uint32_t | reuseable_preferred_lft_ |
| Remaining preferred lifetime. More... | |
| Lease::Type | type_ |
| Lease type. More... | |
Public Attributes inherited from isc::dhcp::Lease | |
| isc::asiolink::IOAddress | addr_ |
| IPv4 ot IPv6 address. More... | |
| uint32_t | valid_lft_ |
| Valid lifetime. More... | |
| uint32_t | current_valid_lft_ |
| Current valid lifetime. More... | |
| uint32_t | reuseable_valid_lft_ |
| Remaining valid lifetime. More... | |
| time_t | cltt_ |
| Client last transmission time. More... | |
| time_t | current_cltt_ |
| Current client last transmission time. More... | |
| SubnetID | subnet_id_ |
| Subnet identifier. More... | |
| std::string | hostname_ |
| Client hostname. More... | |
| bool | fqdn_fwd_ |
| Forward zone updated? More... | |
| bool | fqdn_rev_ |
| Reverse zone updated? More... | |
| HWAddrPtr | hwaddr_ |
| Client's MAC/hardware address. More... | |
| uint32_t | state_ |
| Holds the lease state(s). More... | |
Additional Inherited Members | |
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... | |
Static Public Attributes inherited from isc::dhcp::Lease | |
| static const uint32_t | INFINITY_LFT = 0xffffffff |
| Infinity (means static, i.e. never expire) More... | |
| static const uint32_t | STATE_DEFAULT = 0x0 |
| A lease in the default state. More... | |
| static const uint32_t | STATE_DECLINED = 0x1 |
| Declined lease. More... | |
| static const uint32_t | STATE_EXPIRED_RECLAIMED = 0x2 |
| Expired and reclaimed lease. More... | |
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. More... | |
Protected Attributes inherited from isc::data::UserContext | |
| data::ConstElementPtr | user_context_ |
| Pointer to the user context (may be NULL) More... | |
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 490 of file lease.cc.
References isc::dhcp::Lease::cltt_, isc::dhcp::Lease::current_cltt_, and isc_throw.
| 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 504 of file lease.cc.
References isc::dhcp::Lease::cltt_, isc::dhcp::Lease::current_cltt_, and isc_throw.
| isc::dhcp::Lease6::Lease6 | ( | ) |
Constructor.
Initialize fields that don't have a default constructor.
Definition at line 521 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 543 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_.
Here is the call graph for this function:
|
static |
Returns pointer to the IPv6 lease created from JSON representation.
| element | pointer to the data element object to be parsed. |
Definition at line 673 of file lease.cc.
References Lease6(), isc::dhcp::Lease::fromElementCommon(), isc::dhcp::DUID::fromText(), isc::dhcp::DUID::getDuid(), isc::data::Element::integer, isc_throw, isc::data::Element::string, isc::dhcp::Lease::textToType(), and isc::dhcp::Lease::TYPE_PD.
Here is the call graph for this function:| const std::vector< uint8_t > & isc::dhcp::Lease6::getDuidVector | ( | ) | const |
Returns a reference to a vector representing a DUID.
Definition at line 533 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 619 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(), 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_.
Here is the call graph for this function:
|
static |
Returns name of the lease states specific to DHCPv6.
| state | Numeric value holding lease states. |
Definition at line 528 of file lease.cc.
References isc::dhcp::Lease::basicStatesToText().
Referenced by toText().
Here is the call graph for this function:
|
virtual |
Return the JSON representation of a lease.
Implements isc::data::CfgToElement.
Definition at line 642 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_, 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_.
Referenced by isc::ha::CommandCreator::createLease6Delete(), and isc::ha::CommandCreator::createLease6Update().
Here is the call graph for this function:
|
virtual |
Convert Lease to Printable Form.
Implements isc::dhcp::Lease.
Definition at line 556 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(), preferred_lft_, prefixlen_, isc::dhcp::Lease::state_, statesToText(), isc::dhcp::Lease::subnet_id_, type_, isc::dhcp::Lease::typeToText(), and isc::dhcp::Lease::valid_lft_.
Here is the call graph for this function:| DuidPtr isc::dhcp::Lease6::duid_ |
Client identifier.
Definition at line 534 of file lease.h.
Referenced by isc::dhcp::CSVLeaseFile6::append(), decline(), getDuidVector(), operator==(), toElement(), and toText().
| 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 531 of file lease.h.
Referenced by isc::dhcp::CSVLeaseFile6::append(), 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 540 of file lease.h.
Referenced by isc::dhcp::CSVLeaseFile6::append(), 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 524 of file lease.h.
Referenced by isc::dhcp::CSVLeaseFile6::append(), isc::dhcp::AllocEngine::makeIPv6Resrv(), 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 548 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 519 of file lease.h.
Referenced by isc::dhcp::CSVLeaseFile6::append(), getType(), isc::dhcp::AllocEngine::makeIPv6Resrv(), operator==(), toElement(), and toText().