33#include <boost/scoped_ptr.hpp>
34#include <boost/algorithm/string.hpp>
92 if (txt ==
"address") {
94 }
else if (txt ==
"hw-address") {
96 }
else if (txt ==
"duid") {
98 }
else if (txt ==
"client-id") {
102 << txt <<
", the only supported values are: "
103 "address, hw-address, duid");
378 const int control_result,
379 const std::string& error_message)
const;
392 short family = AF_INET)
const;
451 if (!lease->stateExpiredReclaimed()) {
454 "assigned-addresses"),
456 if (lease->stateDeclined()) {
461 "declined-addresses"),
469 if (!lease->stateExpiredReclaimed()) {
473 "assigned-nas" :
"assigned-pds"),
475 if (lease->stateDeclined()) {
480 "declined-addresses"),
489 if (!existing->stateExpiredReclaimed()) {
491 if (existing->subnet_id_ != lease->subnet_id_) {
494 "assigned-addresses"),
497 if (existing->stateDeclined()) {
503 "declined-addresses"),
506 if (!lease->stateExpiredReclaimed()) {
508 if (existing->subnet_id_ != lease->subnet_id_) {
511 "assigned-addresses"),
514 if (lease->stateDeclined()) {
520 "declined-addresses"),
526 if (!lease->stateExpiredReclaimed()) {
530 "assigned-addresses"),
532 if (lease->stateDeclined()) {
538 "declined-addresses"),
548 if (!existing->stateExpiredReclaimed()) {
550 if (existing->subnet_id_ != lease->subnet_id_) {
554 "assigned-nas" :
"assigned-pds"),
557 if (existing->stateDeclined()) {
563 "declined-addresses"),
566 if (!lease->stateExpiredReclaimed()) {
568 if (existing->subnet_id_ != lease->subnet_id_) {
572 "assigned-nas" :
"assigned-pds"),
575 if (lease->stateDeclined()) {
581 "declined-addresses"),
587 if (!lease->stateExpiredReclaimed()) {
592 "assigned-nas" :
"assigned-pds"),
594 if (lease->stateDeclined()) {
600 "declined-addresses"),
609 if (!lease->stateExpiredReclaimed()) {
612 "assigned-addresses"),
614 if (lease->stateDeclined()) {
619 "declined-addresses"),
627 if (!lease->stateExpiredReclaimed()) {
631 "assigned-nas" :
"assigned-pds"),
633 if (lease->stateDeclined()) {
638 "declined-addresses"),
647 if (force_create && !existing) {
651 "lost race between calls to get and add");
666 << lease->addr_ <<
" either because the lease has been "
667 "deleted or it has changed in the database, in both cases a "
668 "retry might succeed");
679 if (force_create && !existing) {
683 "lost race between calls to get and add");
698 << lease->addr_ <<
" either because the lease has been "
699 "deleted or it has changed in the database, in both cases a "
700 "retry might succeed");
712 string txt =
"malformed command";
719 txt =
"(missing parameters)";
731 bool force_create =
false;
743 if (resource_handler.
tryLock4(lease4->addr_)) {
747 "ResourceBusy: IP address:" << lease4->addr_
748 <<
" could not be added.");
757 resp <<
"Lease for address " << lease4->addr_.toText()
758 <<
", subnet-id " << lease4->subnet_id_ <<
" added.";
771 if (resource_handler.
tryLock(lease6->type_, lease6->addr_)) {
775 "ResourceBusy: IP address:" << lease6->addr_
776 <<
" could not be added.");
786 resp <<
"Lease for address " << lease6->addr_.toText()
787 <<
", subnet-id " << lease6->subnet_id_ <<
" added.";
789 resp <<
"Lease for prefix " << lease6->addr_.toText()
790 <<
"/" <<
static_cast<int>(lease6->prefixlen_)
791 <<
", subnet-id " << lease6->subnet_id_ <<
" added.";
796 }
catch (
const std::exception& ex) {
818 if (params->contains(
"update-ddns")) {
831 if (params->contains(
"type")) {
832 string t = params->get(
"type")->stringValue();
833 if (t ==
"IA_NA" || t ==
"0") {
835 }
else if (t ==
"IA_TA" || t ==
"1") {
837 }
else if (t ==
"IA_PD" || t ==
"2") {
839 }
else if (t ==
"V4" || t ==
"3") {
843 << t <<
", only supported values are: IA_NA, IA_TA,"
858 txt <<
"Invalid " << (v6 ?
"IPv6" :
"IPv4")
859 <<
" address specified: " << tmp->stringValue();
867 tmp = params->get(
"subnet-id");
876 if (params->contains(
"iaid")) {
877 x.
iaid = params->get(
"iaid")->intValue();
888 " and 'identifier-type' is either missing or not a string.");
892 " and 'identifier' is either missing or not a string.");
921 " is not supported.");
953 "requires hwaddr to be specified");
966 "requires duid to be specified");
980 "requires client-id to be specified");
994 }
catch (
const std::exception& ex) {
1001 lease_json = lease4->toElement();
1003 "IPv4 lease found.", lease_json);
1005 }
else if (!v4 && lease6) {
1006 lease_json = lease6->toElement();
1008 "IPv6 lease found.", lease_json);
1038 const std::vector<ElementPtr>& subnet_ids = subnets->listValue();
1039 for (
auto subnet_id = subnet_ids.begin();
1040 subnet_id != subnet_ids.end();
1049 for (
auto lease : leases) {
1051 leases_json->add(lease_json);
1056 for (
auto lease : leases) {
1058 leases_json->add(lease_json);
1067 for (
auto lease : leases) {
1069 leases_json->add(lease_json);
1073 for (
auto lease : leases) {
1075 leases_json->add(lease_json);
1080 std::ostringstream s;
1081 s << leases_json->size()
1082 <<
" IPv" << (v4 ?
"4" :
"6")
1083 <<
" lease(s) found.";
1085 args->set(
"leases", leases_json);
1093 }
catch (
const std::exception& ex) {
1127 boost::scoped_ptr<IOAddress> from_address;
1129 if (from->stringValue() ==
"start") {
1130 from_address.reset(
new IOAddress(v4 ?
"0.0.0.0" :
"::"));
1134 from_address.reset(
new IOAddress(from->stringValue()));
1139 "a valid IPv" << (v4 ?
"4" :
"6") <<
" address");
1144 if (v4 && (!from_address->isV4())) {
1146 <<
" is not an IPv4 address");
1148 }
else if (!v4 && from_address->isV4()) {
1150 <<
" is not an IPv6 address");
1165 size_t page_limit_value =
static_cast<size_t>(page_limit->intValue());
1176 for (
auto lease : leases) {
1178 leases_json->add(lease_json);
1187 for (
auto lease : leases) {
1189 leases_json->add(lease_json);
1194 std::ostringstream s;
1195 s << leases_json->size()
1196 <<
" IPv" << (v4 ?
"4" :
"6")
1197 <<
" lease(s) found.";
1201 args->set(
"leases", leases_json);
1202 args->set(
"count",
Element::create(
static_cast<int64_t
>(leases_json->size())));
1212 }
catch (
const std::exception& ex) {
1246 for (
auto lease : leases) {
1248 leases_json->add(lease_json);
1251 std::ostringstream s;
1252 s << leases_json->size() <<
" IPv4 lease(s) found.";
1254 args->set(
"leases", leases_json);
1262 }
catch (
const std::exception& ex) {
1296 for (
auto lease : leases) {
1298 leases_json->add(lease_json);
1301 std::ostringstream s;
1302 s << leases_json->size() <<
" IPv4 lease(s) found.";
1304 args->set(
"leases", leases_json);
1312 }
catch (
const std::exception& ex) {
1346 for (
auto lease : leases) {
1348 leases_json->add(lease_json);
1351 std::ostringstream s;
1352 s << leases_json->size() <<
" IPv6 lease(s) found.";
1354 args->set(
"leases", leases_json);
1362 }
catch (
const std::exception& ex) {
1375 v4 = (
cmd_name_ ==
"lease4-get-by-hostname");
1393 std::string hostname_ = hostname->stringValue();
1395 if (hostname_.empty()) {
1398 boost::algorithm::to_lower(hostname_);
1405 for (
auto lease : leases) {
1407 leases_json->add(lease_json);
1413 for (
auto lease : leases) {
1415 leases_json->add(lease_json);
1419 std::ostringstream s;
1420 s << leases_json->size()
1421 <<
" IPv" << (v4 ?
"4" :
"6")
1422 <<
" lease(s) found.";
1424 args->set(
"leases", leases_json);
1432 }
catch (
const std::exception& ex) {
1461 "requires hwaddr to be specified");
1475 "requires client-id to be specified");
1508 }
catch (
const std::exception& ex) {
1527 auto deleted_leases =
cmd_args_->get(
"deleted-leases");
1530 if (!deleted_leases && !leases) {
1536 if (deleted_leases && (deleted_leases->getType() !=
Element::list)) {
1548 std::list<std::pair<Parameters, Lease6Ptr> > parsed_deleted_list;
1549 if (deleted_leases) {
1550 auto leases_list = deleted_leases->listValue();
1553 for (
auto lease_params : leases_list) {
1558 parsed_deleted_list.push_back(std::make_pair(p, lease));
1564 std::list<Lease6Ptr> parsed_leases_list;
1569 auto leases_list = leases->listValue();
1570 for (
auto lease_params : leases_list) {
1577 Lease6Ptr lease6 = parser.
parse(config, lease_params, force_update);
1578 parsed_leases_list.push_back(lease6);
1583 size_t success_count = 0;
1586 if (!parsed_deleted_list.empty()) {
1589 for (
auto lease_params_pair : parsed_deleted_list) {
1594 auto lease = lease_params_pair.second;
1607 if (!failed_deleted_list) {
1618 "lease not found"));
1622 }
catch (
const std::exception& ex) {
1624 if (!failed_deleted_list) {
1637 if (!parsed_leases_list.empty()) {
1641 for (
auto lease : parsed_leases_list) {
1650 if (resource_handler.
tryLock(lease->type_, lease->addr_)) {
1654 "ResourceBusy: IP address:" << lease->addr_
1655 <<
" could not be updated.");
1660 }
catch (
const std::exception& ex) {
1662 if (!failed_leases_list) {
1677 if (failed_deleted_list || failed_leases_list) {
1682 if (failed_deleted_list) {
1683 args->set(
"failed-deleted-leases", failed_deleted_list);
1687 if (failed_leases_list) {
1688 args->set(
"failed-leases", failed_leases_list);
1693 std::ostringstream resp_text;
1694 resp_text <<
"Bulk apply of " << success_count <<
" IPv6 leases completed.";
1699 }
catch (
const std::exception& ex) {
1736 "requires duid to be specified");
1766 }
catch (
const std::exception& ex) {
1788 bool force_create =
false;
1800 if (resource_handler.
tryLock4(lease4->addr_)) {
1804 "ResourceBusy: IP address:" << lease4->addr_
1805 <<
" could not be updated.");
1814 }
catch (
const std::exception& ex) {
1836 bool force_create =
false;
1848 if (resource_handler.
tryLock(lease6->type_, lease6->addr_)) {
1852 "ResourceBusy: IP address:" << lease6->addr_
1853 <<
" could not be updated.");
1862 }
catch (
const std::exception& ex) {
1894 int64_t previous_declined = 0;
1897 previous_declined = observation->getInteger().first;
1916 for (
auto sub : *subs) {
1918 ids <<
" " << sub->getID();
1932 tmp <<
"Deleted " << num <<
" IPv4 lease(s) from subnet(s)" << ids.str();
1936 }
catch (
const std::exception& ex) {
1974 int64_t previous_declined = 0;
1977 previous_declined = observation->getInteger().first;
2000 for (
auto sub : *subs) {
2002 ids <<
" " << sub->getID();
2020 tmp <<
"Deleted " << num <<
" IPv6 lease(s) from subnet(s)" << ids.str();
2024 }
catch (
const std::exception& ex) {
2044 lease6.reset(
new Lease6());
2045 lease6->addr_ = parameters.
addr;
2054 if (!parameters.
duid) {
2056 "requires duid to be specified");
2076 short family)
const {
2089 }
catch (
const std::exception& ex) {
2091 <<
"' is not a valid IP address.");
2096 << (family == AF_INET6 ?
"IPv6" :
"IPv4")
2097 <<
" address specified: " << param->stringValue());
2105 std::stringstream ss;
2115 ss <<
"DDNS updating is not enabled";
2120 ss <<
"No lease found for: " << addr.
toText();
2122 }
else if (lease->hostname_.empty()) {
2123 ss <<
"Lease for: " << addr.
toText()
2124 <<
", has no hostname, nothing to update";
2125 }
else if (!lease->fqdn_fwd_ && !lease->fqdn_rev_) {
2126 ss <<
"Neither forward nor reverse updates enabled for lease for: "
2132 ss <<
"NCR generated for: " << addr.
toText()
2133 <<
", hostname: " << lease->hostname_;
2139 }
catch (
const std::exception& ex) {
2150 std::stringstream ss;
2160 ss <<
"DDNS updating is not enabled";
2165 ss <<
"No lease found for: " << addr.
toText();
2167 }
else if (lease->hostname_.empty()) {
2168 ss <<
"Lease for: " << addr.
toText()
2169 <<
", has no hostname, nothing to update";
2170 }
else if (!lease->fqdn_fwd_ && !lease->fqdn_rev_) {
2171 ss <<
"Neither forward nor reverse updates enabled for lease for: "
2177 ss <<
"NCR generated for: " << addr.
toText()
2178 <<
", hostname: " << lease->hostname_;
2184 }
catch (
const std::exception& ex) {
2197 const int control_result,
2198 const std::string& error_message)
const {
2211 failed_lease_map->set(
"error-message",
Element::create(error_message));
2213 return (failed_lease_map);
2218 return (impl_->leaseAddHandler(handle));
2223 return (impl_->lease6BulkApplyHandler(handle));
2228 return (impl_->leaseGetHandler(handle));
2233 return (impl_->leaseGetAllHandler(handle));
2238 return (impl_->leaseGetPageHandler(handle));
2243 return (impl_->leaseGetByHwAddressHandler(handle));
2248 return (impl_->leaseGetByClientIdHandler(handle));
2253 return (impl_->leaseGetByDuidHandler(handle));
2258 return (impl_->leaseGetByHostnameHandler(handle));
2263 return (impl_->lease4DelHandler(handle));
2268 return (impl_->lease6DelHandler(handle));
2273 return (impl_->lease4UpdateHandler(handle));
2278 return (impl_->lease6UpdateHandler(handle));
2284 return (impl_->lease4WipeHandler(handle));
2290 return (impl_->lease6WipeHandler(handle));
2295 return (impl_->lease4ResendDdnsHandler(handle));
2300 return (impl_->lease6ResendDdnsHandler(handle));
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown if a function is called in a prohibited way.
A generic exception that is thrown if a parameter given to a method or function is considered invalid...
The IOAddress class represents an IP addresses (version agnostic)
std::string toText() const
Convert the address to a string.
bool isV6() const
Convenience function to check for an IPv6 address.
bool isV4() const
Convenience function to check for an IPv4 address.
bool isV6Zero() const
Convenience function to check if it is an IPv4 zero address.
short getFamily() const
Returns the address family.
static const IOAddress & IPV6_ZERO_ADDRESS()
Returns an IPv6 zero address.
Base class that command handler implementers may use for common tasks.
std::string cmd_name_
Stores the command name extracted by a call to extractCommand.
void setErrorResponse(hooks::CalloutHandle &handle, const std::string &text, int status=CONTROL_RESULT_ERROR)
Set the callout argument "response" to indicate an error.
data::ConstElementPtr cmd_args_
Stores the command arguments extracted by a call to extractCommand.
void extractCommand(hooks::CalloutHandle &handle)
Extracts the command name and arguments from a Callout handle.
void setSuccessResponse(hooks::CalloutHandle &handle, const std::string &text)
Set the callout argument "response" to indicate success.
void setResponse(hooks::CalloutHandle &handle, data::ConstElementPtr &response)
Set the callout argument "response" to the given response.
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
uint32_t getUint32(isc::data::ConstElementPtr scope, const std::string &name)
Returns a value converted to uint32_t.
Database duplicate entry error.
static CfgMgr & instance()
returns a single instance of Configuration Manager
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
static ClientIdPtr fromText(const std::string &text)
Create client identifier from the textual format.
Holds DUID (DHCPv6 Unique Identifier)
static DUID fromText(const std::string &text)
Create DUID from the textual format.
static LeaseMgr & instance()
Return current lease manager.
virtual Lease6Collection getLeases6(Lease::Type type, const DUID &duid, uint32_t iaid) const =0
Returns existing IPv6 leases for a given DUID+IA combination.
virtual size_t wipeLeases6(const SubnetID &subnet_id)=0
Virtual method which removes specified leases.
virtual Lease4Collection getLeases4(SubnetID subnet_id) const =0
Returns all IPv4 leases for the particular subnet identifier.
virtual Lease4Ptr getLease4(const isc::asiolink::IOAddress &addr) const =0
Returns an IPv4 lease for specified IPv4 address.
virtual bool addLease(const Lease4Ptr &lease)=0
Adds an IPv4 lease.
virtual size_t wipeLeases4(const SubnetID &subnet_id)=0
Virtual method which removes specified leases.
virtual void updateLease4(const Lease4Ptr &lease4)=0
Updates IPv4 lease.
virtual Lease6Ptr getLease6(Lease::Type type, const isc::asiolink::IOAddress &addr) const =0
Returns existing IPv6 lease for a given IPv6 address.
virtual void updateLease6(const Lease6Ptr &lease6)=0
Updates IPv6 lease.
Wraps value holding size of the page with leases.
Attempt to update lease that was not there.
Thrown by lock users when a resource lock cannot be obtained.
Resource race avoidance RAII handler for DHCPv4.
bool tryLock4(const asiolink::IOAddress &addr)
Tries to acquires a resource.
Resource race avoidance RAII handler.
bool tryLock(Lease::Type type, const asiolink::IOAddress &addr)
Tries to acquires a resource.
Per-packet callout handle.
Parser for Lease4 structure.
virtual isc::dhcp::Lease4Ptr parse(isc::dhcp::ConstSrvConfigPtr &cfg, const isc::data::ConstElementPtr &lease_info, bool &force_create)
Parses Element tree and tries to convert to Lease4.
Parser for Lease6 structure.
virtual isc::dhcp::Lease6Ptr parse(isc::dhcp::ConstSrvConfigPtr &cfg, const isc::data::ConstElementPtr &lease_info, bool &force_create)
Parses Element tree and tries to convert to Lease4.
Parameters specified for lease commands.
uint32_t iaid
IAID identifier used for v6 leases.
HWAddrPtr hwaddr
Specifies hardware address (used when query_type is TYPE_HWADDR)
Lease::Type lease_type
Lease type (NA,TA or PD) used for v6 leases.
Type query_type
specifies parameter types
Type
specifies type of query (by IP addr, by hwaddr, by DUID)
@ TYPE_DUID
query by DUID (v6 only)
@ TYPE_CLIENT_ID
query by client identifier (v4 only).
@ TYPE_HWADDR
query by hardware address (v4 only)
@ TYPE_ADDR
query by IP address (either v4 or v6)
isc::dhcp::ClientIdPtr client_id
Specifies identifier value (used when query_type is TYPE_CLIENT_ID)
static Type txtToType(const std::string &txt)
Attempts to covert text to one of specified types.
Parameters()
Default constructor.
bool updateDDNS
Indicates whether or not DNS should be updated.
IOAddress addr
Specifies IPv4/v6 address (used when query_type is TYPE_ADDR)
SubnetID subnet_id
Specifies subnet-id (always used)
isc::dhcp::DuidPtr duid
Specifies identifier value (used when query_type is TYPE_DUID)
Wrapper class around reservation command handlers.
int lease4DelHandler(CalloutHandle &handle)
lease4-del command handler
IOAddress getAddressParam(ConstElementPtr params, const std::string name, short family=AF_INET) const
static void updateStatsOnUpdate(const Lease4Ptr &existing, const Lease4Ptr &lease)
Update stats when updating lease.
ElementPtr createFailedLeaseMap(const Lease::Type &lease_type, const IOAddress &lease_address, const DuidPtr &duid, const int control_result, const std::string &error_message) const
Returns a map holding brief information about a lease which failed to be deleted, updated or added.
static bool addOrUpdate6(Lease6Ptr lease, bool force_create)
Add or update lease.
int lease6BulkApplyHandler(CalloutHandle &handle)
lease6-bulk-apply command handler
int leaseGetByDuidHandler(hooks::CalloutHandle &handle)
lease6-get-by-duid command handler
int lease6UpdateHandler(CalloutHandle &handle)
lease6-update handler
int leaseGetPageHandler(hooks::CalloutHandle &handle)
lease4-get-page, lease6-get-page commands handler
Lease6Ptr getIPv6LeaseForDelete(const Parameters ¶meters) const
Convenience function fetching IPv6 address to be used to delete a lease.
int leaseGetByHostnameHandler(hooks::CalloutHandle &handle)
lease4-get-by-hostname and lease6-get-by-hostname commands handler
int lease6DelHandler(CalloutHandle &handle)
lease6-del command handler
int leaseGetByHwAddressHandler(hooks::CalloutHandle &handle)
lease4-get-by-hw-address command handler
int leaseGetHandler(CalloutHandle &handle)
lease4-get, lease6-get command handler
static bool addOrUpdate4(Lease4Ptr lease, bool force_create)
Add or update lease.
int lease6WipeHandler(CalloutHandle &handle)
lease6-wipe handler
int leaseGetByClientIdHandler(hooks::CalloutHandle &handle)
lease4-get-by-client-id command handler
int lease6ResendDdnsHandler(CalloutHandle &handle)
lease6-resend-ddns handler
int leaseAddHandler(CalloutHandle &handle)
lease4-add, lease6-add command handler
int lease4ResendDdnsHandler(CalloutHandle &handle)
lease4-resend-ddns handler
static void updateStatsOnAdd(const Lease4Ptr &lease)
Update stats when adding lease.
Parameters getParameters(bool v6, const ConstElementPtr &args)
Extracts parameters required for reservation-get and reservation-del.
int lease4UpdateHandler(CalloutHandle &handle)
lease4-update handler
int lease4WipeHandler(CalloutHandle &handle)
lease4-wipe handler
int leaseGetAllHandler(CalloutHandle &handle)
lease4-get-all, lease6-get-all commands handler
static void updateStatsOnDelete(const Lease4Ptr &lease)
Update stats when deleting lease.
int lease4ResendDdnsHandler(hooks::CalloutHandle &handle)
lease4-resend-ddns command handler
int lease6WipeHandler(hooks::CalloutHandle &handle)
lease6-wipe handler
int leaseGetPageHandler(hooks::CalloutHandle &handle)
lease4-get-page, lease6-get-page commands handler
int lease6DelHandler(hooks::CalloutHandle &handle)
lease6-del command handler
int leaseGetAllHandler(hooks::CalloutHandle &handle)
lease4-get-all, lease6-get-all commands handler
int leaseGetByHostnameHandler(hooks::CalloutHandle &handle)
lease4-get-by-hostname and lease6-get-by-hostname commands handler
int lease4DelHandler(hooks::CalloutHandle &handle)
lease4-del command handler
int leaseAddHandler(hooks::CalloutHandle &handle)
lease4-add, lease6-add command handler
int leaseGetByClientIdHandler(hooks::CalloutHandle &handle)
lease4-get-by-client-id command handler
int lease4UpdateHandler(hooks::CalloutHandle &handle)
lease4-update handler
int leaseGetHandler(hooks::CalloutHandle &handle)
lease4-get, lease6-get command handler
int leaseGetByHwAddressHandler(hooks::CalloutHandle &handle)
lease4-get-by-hw-address command handler
int lease6UpdateHandler(hooks::CalloutHandle &handle)
lease6-update handler
int leaseGetByDuidHandler(hooks::CalloutHandle &handle)
lease6-get-by-duid command handler
int lease6BulkApplyHandler(hooks::CalloutHandle &handle)
lease6-bulk-apply command handler
int lease4WipeHandler(hooks::CalloutHandle &handle)
lease4-wipe handler
int lease6ResendDdnsHandler(hooks::CalloutHandle &handle)
lease6-resend-ddns command handler
ObservationPtr getObservation(const std::string &name) const
Returns an observation.
static StatsMgr & instance()
Statistics Manager accessor method.
static std::string generateName(const std::string &context, Type index, const std::string &stat_name)
Generates statistic name in a given context.
RAII class creating a critical section.
static MultiThreadingMgr & instance()
Returns a single instance of Multi Threading Manager.
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
void setValue(const std::string &name, const int64_t value)
Records absolute integer observation.
void addValue(const std::string &name, const int64_t value)
Records incremental integer observation.
const isc::log::MessageID LEASE_CMDS_RESEND_DDNS4_FAILED
const isc::log::MessageID LEASE_CMDS_ADD4_FAILED
const isc::log::MessageID LEASE_CMDS_ADD6
const isc::log::MessageID LEASE_CMDS_ADD4
const isc::log::MessageID LEASE_CMDS_RESEND_DDNS4
const isc::log::MessageID LEASE_CMDS_RESEND_DDNS6_FAILED
const isc::log::MessageID LEASE_CMDS_RESEND_DDNS6
const isc::log::MessageID LEASE_CMDS_ADD6_FAILED
An abstract API for lease database.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
const int CONTROL_RESULT_EMPTY
Status code indicating that the specified command was completed correctly, but failed to produce any ...
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< const SrvConfig > ConstSrvConfigPtr
Const pointer to the SrvConfig.
void queueNCR(const NameChangeType &chg_type, const Lease4Ptr &lease)
Creates name change request from the DHCPv4 lease.
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::multi_index_container< Subnet6Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > > > Subnet6Collection
A collection of Subnet6 objects.
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
boost::multi_index_container< Subnet4Ptr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetSubnetIdIndexTag >, boost::multi_index::const_mem_fun< Subnet, SubnetID, &Subnet::getID > >, boost::multi_index::ordered_unique< boost::multi_index::tag< SubnetPrefixIndexTag >, boost::multi_index::const_mem_fun< Subnet, std::string, &Subnet::toText > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetServerIdIndexTag >, boost::multi_index::const_mem_fun< Network4, asiolink::IOAddress, &Network4::getServerId > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< SubnetModificationTimeIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::BaseStampedElement::getModificationTime > > > > Subnet4Collection
A collection of Subnet4 objects.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
boost::shared_ptr< ClientId > ClientIdPtr
Shared pointer to a Client ID.
boost::shared_ptr< const CfgSubnets4 > ConstCfgSubnets4Ptr
Const pointer.
boost::shared_ptr< const CfgSubnets6 > ConstCfgSubnets6Ptr
Const pointer.
std::vector< Lease4Ptr > Lease4Collection
A collection of IPv4 leases.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
isc::log::Logger lease_cmds_logger("lease-cmds-hooks")
Defines the logger used by the top-level component of kea-lfc.
Hardware type that represents information from DHCPv4 packet.
static HWAddr fromText(const std::string &text, const uint16_t htype=HTYPE_ETHER)
Creates instance of the hardware address from textual format.
Structure that holds a lease for IPv6 address and/or prefix.
a common structure for IPv4 and IPv6 leases
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...
static std::string typeToText(Type type)
returns text representation of a lease type