107 uint32_t valid_lft,
SubnetID subnet_id, time_t cltt,
108 const bool fqdn_fwd,
const bool fqdn_rev,
109 const std::string& hostname,
251 virtual void decline(uint32_t probation_period) = 0;
324 const uint8_t* clientid,
size_t clientid_len, uint32_t valid_lft,
325 time_t cltt, uint32_t subnet_id,
326 const bool fqdn_fwd =
false,
const bool fqdn_rev =
false,
327 const std::string& hostname =
"")
328 :
Lease(addr, valid_lft, subnet_id, cltt, fqdn_fwd, fqdn_rev,
349 const uint32_t valid_lifetime,
352 const bool fqdn_fwd =
false,
353 const bool fqdn_rev =
false,
354 const std::string& hostname =
"");
465 return (!
operator==(other));
471 virtual std::string
toText()
const;
478 void decline(uint32_t probation_period);
575 uint32_t iaid, uint32_t preferred, uint32_t valid,
577 uint8_t prefixlen = 128);
594 uint32_t iaid, uint32_t preferred, uint32_t valid,
595 SubnetID subnet_id,
const bool fqdn_fwd,
596 const bool fqdn_rev,
const std::string& hostname,
639 void decline(uint32_t probation_period);
650 return (!
operator==(other));
656 virtual std::string
toText()
const;
691template <isc::util::DhcpSpace D>
692struct AdapterLease {};
706template <isc::util::DhcpSpace D>
707using LeaseT =
typename AdapterLease<D>::type;
709template <isc::util::DhcpSpace D>
The IOAddress class represents an IP addresses (version agnostic)
Holds Client identifier or client IPv4 address.
std::ostream & operator<<(std::ostream &os, const IOAddress &address)
Insert the IOAddress as a string into stream.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< Lease4Collection > Lease4CollectionPtr
A shared pointer to the collection of IPv4 leases.
boost::shared_ptr< DUID > DuidPtr
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
boost::shared_ptr< LeaseT< D > > LeaseTPtr
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
boost::shared_ptr< Lease > LeasePtr
Pointer to the lease object.
boost::shared_ptr< ClientId > ClientIdPtr
Shared pointer to a Client ID.
boost::shared_ptr< Lease6Collection > Lease6CollectionPtr
A shared pointer to the collection of IPv6 leases.
boost::shared_ptr< const Lease6 > ConstLease6Ptr
Pointer to a const Lease6 structure.
typename AdapterLease< D >::type LeaseT
std::vector< Lease4Ptr > Lease4Collection
A collection of IPv4 leases.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
virtual isc::data::ElementPtr toElement() const =0
Unparse a configuration object.
Base class for user context.
Structure that holds a lease for IPv4 address.
ClientIdPtr client_id_
Client identifier.
void decline(uint32_t probation_period)
Sets IPv4 lease to declined state.
static std::string statesToText(const uint32_t state)
Returns name of the lease states specific to DHCPv4.
Lease4(const isc::asiolink::IOAddress &addr, const HWAddrPtr &hwaddr, const uint8_t *clientid, size_t clientid_len, uint32_t valid_lft, time_t cltt, uint32_t subnet_id, const bool fqdn_fwd=false, const bool fqdn_rev=false, const std::string &hostname="")
Constructor.
bool operator==(const Lease4 &other) const
Compare two leases for equality.
virtual Lease::Type getType() const
Returns Lease type.
std::vector< uint8_t > remote_id_
Remote identifier for Bulk Lease Query.
std::vector< uint8_t > relay_id_
Relay identifier for Bulk Lease Query.
bool operator!=(const Lease4 &other) const
Compare two leases for inequality.
const std::vector< uint8_t > & getClientIdVector() const
Returns a client identifier.
virtual isc::data::ElementPtr toElement() const
Return the JSON representation of a lease.
bool belongsToClient(const HWAddrPtr &hw_address, const ClientIdPtr &client_id) const
Check if the lease belongs to the client with the given identifiers.
Lease4()
Default constructor.
virtual std::string toText() const
Convert lease to printable form.
static Lease4Ptr fromElement(const data::ConstElementPtr &element)
Returns pointer to the IPv4 lease created from JSON representation.
Structure that holds a lease for IPv6 address and/or prefix.
ExtendedInfoAction extended_info_action_
Record the action on extended info tables in the lease.
const std::vector< uint8_t > & getDuidVector() const
Returns a reference to a vector representing a DUID.
virtual Lease::Type getType() const
Returns Lease type.
ExtendedInfoAction
Action on extended info tables.
@ ACTION_UPDATE
update extended info tables.
@ ACTION_DELETE
delete reference to the lease
@ ACTION_IGNORE
ignore extended info,
virtual std::string toText() const
Convert Lease to Printable Form.
bool operator==(const Lease6 &other) const
Compare two leases for equality.
static std::string statesToText(const uint32_t state)
Returns name of the lease states specific to DHCPv6.
Lease::Type type_
Lease type.
uint32_t reuseable_preferred_lft_
Remaining preferred lifetime.
bool operator!=(const Lease6 &other) const
Compare two leases for inequality.
uint32_t iaid_
Identity Association Identifier (IAID)
uint32_t preferred_lft_
Preferred lifetime.
DuidPtr duid_
Client identifier.
static Lease6Ptr fromElement(const data::ConstElementPtr &element)
Returns pointer to the IPv6 lease created from JSON representation.
uint8_t prefixlen_
IPv6 prefix length.
virtual isc::data::ElementPtr toElement() const
Return the JSON representation of a lease.
void decline(uint32_t probation_period)
Sets IPv6 lease to declined state.
a common structure for IPv4 and IPv6 leases
void updateCurrentExpirationTime()
Update lease current expiration time with new value, so that additional operations can be done withou...
bool hasIdenticalFqdn(const Lease &other) const
Returns true if the other lease has equal FQDN data.
virtual void decline(uint32_t probation_period)=0
Sets lease to DECLINED state.
static const uint32_t INFINITY_LFT
Infinity (means static, i.e. never expire)
virtual ~Lease()
Destructor.
uint32_t reuseable_valid_lft_
Remaining valid lifetime.
static std::string lifetimeToText(uint32_t lifetime)
Print lifetime.
bool stateDeclined() const
Indicates if the lease is in the "declined" state.
bool stateExpiredReclaimed() const
Indicates if the lease is in the "expired-reclaimed" state.
static const uint32_t STATE_DEFAULT
A lease in the default state.
uint32_t current_valid_lft_
Current valid lifetime.
SubnetID subnet_id_
Subnet identifier.
uint32_t pool_id_
The pool id.
const std::vector< uint8_t > & getHWAddrVector() const
Returns raw (as vector) hardware address.
uint32_t valid_lft_
Valid lifetime.
static std::string basicStatesToText(const uint32_t state)
Returns name(s) of the basic lease state(s).
static const uint32_t STATE_DECLINED
Declined lease.
bool expired() const
returns true if the lease is expired
static const uint32_t STATE_RELEASED
Released lease held in the database for lease affinity.
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.
static const uint32_t STATE_EXPIRED_RECLAIMED
Expired and reclaimed lease.
Type
Type of lease or pool.
@ TYPE_TA
the lease contains temporary IPv6 address
@ TYPE_PD
the lease contains IPv6 prefix (for prefix delegation)
@ TYPE_NA
the lease contains non-temporary IPv6 address
static void syncCurrentExpirationTime(const Lease &from, Lease &to)
Sync lease current expiration time with new value from another lease, so that additional operations c...
std::string hostname_
Client hostname.
uint32_t state_
Holds the lease state(s).
virtual Lease::Type getType() const =0
Returns Lease type.
int64_t getExpirationTime() const
Returns lease expiration time.
bool fqdn_fwd_
Forward zone updated?
time_t cltt_
Client last transmission time.
virtual std::string toText() const =0
Convert Lease to Printable Form.
static void fromElementCommon(const LeasePtr &lease, const data::ConstElementPtr &element)
Sets common (for v4 and v6) properties of the lease object.
static std::string typeToText(Type type)
returns text representation of a lease type
static Type textToType(const std::string &text)
Converts type name to the actual type.
HWAddrPtr hwaddr_
Client's MAC/hardware address.
bool fqdn_rev_
Reverse zone updated?
isc::asiolink::IOAddress addr_
IPv4 ot IPv6 address.
time_t current_cltt_
Current client last transmission time.