19#include <boost/algorithm/string.hpp>
42 : page_size_(page_size) {
48 if (
page_size_ > std::numeric_limits<uint32_t>::max()) {
50 << std::numeric_limits<uint32_t>::max());
56 uint32_t iaid,
SubnetID subnet_id)
const {
61 <<
static_cast<int>(type) <<
", duid "
62 << duid.
toText() <<
", iaid " << iaid
63 <<
" and subnet-id " << subnet_id);
68 return (*col.begin());
73 using namespace stats;
75 StatsMgr& stats_mgr = StatsMgr::instance();
87 stats_mgr.setValue(
"declined-addresses", zero);
90 if (!stats_mgr.getObservation(
"reclaimed-declined-addresses")) {
91 stats_mgr.setValue(
"reclaimed-declined-addresses", zero);
95 if (!stats_mgr.getObservation(
"reclaimed-leases")) {
96 stats_mgr.setValue(
"reclaimed-leases", zero);
100 if (!stats_mgr.getObservation(
"cumulative-assigned-addresses")) {
101 stats_mgr.setValue(
"cumulative-assigned-addresses", zero);
109 for (
auto const& subnet : *subnets) {
110 SubnetID subnet_id = subnet->getID();
111 stats_mgr.setValue(StatsMgr::generateName(
"subnet", subnet_id,
112 "assigned-addresses"),
115 stats_mgr.setValue(StatsMgr::generateName(
"subnet", subnet_id,
116 "declined-addresses"),
119 const std::string name_rec_dec(StatsMgr::generateName(
"subnet", subnet_id,
120 "reclaimed-declined-addresses"));
121 if (!stats_mgr.getObservation(name_rec_dec)) {
122 stats_mgr.setValue(name_rec_dec, zero);
125 const std::string name_rec(StatsMgr::generateName(
"subnet", subnet_id,
126 "reclaimed-leases"));
127 if (!stats_mgr.getObservation(name_rec)) {
128 stats_mgr.setValue(name_rec, zero);
132 const std::string name_aa(StatsMgr::generateName(
"subnet", subnet_id,
133 StatsMgr::generateName(
"pool", pool->getID(),
134 "assigned-addresses")));
135 if (!stats_mgr.getObservation(name_aa)) {
136 stats_mgr.setValue(name_aa, zero);
139 const std::string& name_da(StatsMgr::generateName(
"subnet", subnet_id,
140 StatsMgr::generateName(
"pool", pool->getID(),
141 "declined-addresses")));
142 if (!stats_mgr.getObservation(name_da)) {
143 stats_mgr.setValue(name_da, zero);
146 const std::string& pname_rec_dec(StatsMgr::generateName(
"subnet", subnet_id,
147 StatsMgr::generateName(
"pool", pool->getID(),
148 "reclaimed-declined-addresses")));
149 if (!stats_mgr.getObservation(pname_rec_dec)) {
150 stats_mgr.setValue(pname_rec_dec, zero);
153 const std::string& pname_rec(StatsMgr::generateName(
"subnet", subnet_id,
154 StatsMgr::generateName(
"pool", pool->getID(),
155 "reclaimed-leases")));
156 if (!stats_mgr.getObservation(pname_rec)) {
157 stats_mgr.setValue(pname_rec, zero);
165 while (query->getNextRow(row)) {
168 stats_mgr.addValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
169 "assigned-addresses"),
173 stats_mgr.setValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
174 "declined-addresses"),
178 stats_mgr.addValue(
"declined-addresses", row.state_count_);
182 stats_mgr.addValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
183 "assigned-addresses"),
196 while (query->getNextRow(row)) {
199 stats_mgr.addValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
200 StatsMgr::generateName(
"pool", row.pool_id_,
201 "assigned-addresses")),
205 stats_mgr.setValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
206 StatsMgr::generateName(
"pool", row.pool_id_,
207 "declined-addresses")),
212 stats_mgr.addValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
213 StatsMgr::generateName(
"pool", row.pool_id_,
214 "assigned-addresses")),
221 : first_subnet_id_(0), last_subnet_id_(0), select_mode_(select_mode) {
223 isc_throw(
BadValue,
"LeaseStatsQuery: mode must be either ALL_SUBNETS or ALL_SUBNET_POOLS");
228 : first_subnet_id_(subnet_id), last_subnet_id_(0),
229 select_mode_(SINGLE_SUBNET) {
238 : first_subnet_id_(first_subnet_id), last_subnet_id_(last_subnet_id),
239 select_mode_(SUBNET_RANGE) {
251 "LeaseStatsQuery: last_subnet_id_must be > first_subnet_id_");
283 using namespace stats;
285 StatsMgr& stats_mgr = StatsMgr::instance();
297 stats_mgr.setValue(
"declined-addresses", zero);
299 if (!stats_mgr.getObservation(
"reclaimed-declined-addresses")) {
300 stats_mgr.setValue(
"reclaimed-declined-addresses", zero);
303 if (!stats_mgr.getObservation(
"reclaimed-leases")) {
304 stats_mgr.setValue(
"reclaimed-leases", zero);
308 if (!stats_mgr.getObservation(
"cumulative-assigned-nas")) {
309 stats_mgr.setValue(
"cumulative-assigned-nas", zero);
313 if (!stats_mgr.getObservation(
"cumulative-assigned-pds")) {
314 stats_mgr.setValue(
"cumulative-assigned-pds", zero);
322 for (
auto const& subnet : *subnets) {
323 SubnetID subnet_id = subnet->getID();
324 stats_mgr.setValue(StatsMgr::generateName(
"subnet", subnet_id,
328 stats_mgr.setValue(StatsMgr::generateName(
"subnet", subnet_id,
332 stats_mgr.setValue(StatsMgr::generateName(
"subnet", subnet_id,
333 "declined-addresses"),
336 if (!stats_mgr.getObservation(
337 StatsMgr::generateName(
"subnet", subnet_id,
338 "reclaimed-declined-addresses"))) {
340 StatsMgr::generateName(
"subnet", subnet_id,
341 "reclaimed-declined-addresses"),
345 if (!stats_mgr.getObservation(
346 StatsMgr::generateName(
"subnet", subnet_id,
347 "reclaimed-leases"))) {
349 StatsMgr::generateName(
"subnet", subnet_id,
355 const std::string& name_anas(StatsMgr::generateName(
"subnet", subnet_id,
356 StatsMgr::generateName(
"pool", pool->getID(),
358 if (!stats_mgr.getObservation(name_anas)) {
359 stats_mgr.setValue(name_anas, zero);
362 const std::string& name_da(StatsMgr::generateName(
"subnet", subnet_id,
363 StatsMgr::generateName(
"pool", pool->getID(),
364 "declined-addresses")));
365 if (!stats_mgr.getObservation(name_da)) {
366 stats_mgr.setValue(name_da, zero);
369 const std::string name_rec_dec(StatsMgr::generateName(
"subnet", subnet_id,
370 StatsMgr::generateName(
"pool", pool->getID(),
371 "reclaimed-declined-addresses")));
372 if (!stats_mgr.getObservation(name_rec_dec)) {
373 stats_mgr.setValue(name_rec_dec, zero);
376 const std::string& name_rec(StatsMgr::generateName(
"subnet", subnet_id,
377 StatsMgr::generateName(
"pool", pool->getID(),
378 "reclaimed-leases")));
379 if (!stats_mgr.getObservation(name_rec)) {
380 stats_mgr.setValue(name_rec, zero);
385 const std::string& name_apds(StatsMgr::generateName(
"subnet", subnet_id,
386 StatsMgr::generateName(
"pd-pool", pool->getID(),
388 if (!stats_mgr.getObservation(name_apds)) {
389 stats_mgr.setValue(name_apds, zero);
392 const std::string& name_rec(StatsMgr::generateName(
"subnet", subnet_id,
393 StatsMgr::generateName(
"pd-pool", pool->getID(),
394 "reclaimed-leases")));
395 if (!stats_mgr.getObservation(name_rec)) {
396 stats_mgr.setValue(name_rec, zero);
404 while (query->getNextRow(row)) {
405 switch(row.lease_type_) {
409 stats_mgr.addValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
414 stats_mgr.setValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
415 "declined-addresses"),
419 stats_mgr.addValue(
"declined-addresses", row.state_count_);
423 stats_mgr.addValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
432 stats_mgr.setValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
452 while (query->getNextRow(row)) {
453 switch(row.lease_type_) {
457 stats_mgr.addValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
458 StatsMgr::generateName(
"pool", row.pool_id_,
463 stats_mgr.setValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
464 StatsMgr::generateName(
"pool", row.pool_id_,
465 "declined-addresses")),
470 stats_mgr.addValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
471 StatsMgr::generateName(
"pool", row.pool_id_,
480 stats_mgr.setValue(StatsMgr::generateName(
"subnet", row.subnet_id_,
481 StatsMgr::generateName(
"pd-pool", row.pool_id_,
522 std::string extended_info_tables;
524 extended_info_tables = parameters.at(
"extended-info-tables");
525 }
catch (
const exception&) {
526 extended_info_tables =
"false";
529 if (extended_info_tables ==
"true") {
539 bool changed =
false;
557 string verifying =
"";
558 bool removed_extended_info =
false;
561 verifying =
"user context";
565 if (user_context->empty()) {
572 isc = user_context->get(
"ISC");
576 mutable_user_context =
577 boost::const_pointer_cast<Element>(user_context);
578 if (!mutable_user_context) {
580 mutable_user_context =
copy(user_context, 0);
581 lease->setContext(mutable_user_context);
589 mutable_user_context->remove(
"ISC");
590 if (mutable_user_context->empty()) {
596 verifying =
"relay-agent-info";
597 extended_info =
isc->get(
"relay-agent-info");
598 if (!extended_info) {
601 mutable_isc = boost::const_pointer_cast<Element>(
isc);
605 mutable_user_context->set(
"ISC", mutable_isc);
612 upgraded->set(
"sub-options", extended_info);
613 mutable_isc->set(
"relay-agent-info", upgraded);
617 string rai_hex = extended_info->stringValue();
618 vector<uint8_t> rai_data;
627 vector<uint8_t> bytes = remote_id->toBinary();
628 if (bytes.size() > 0) {
629 upgraded->set(
"remote-id",
636 vector<uint8_t> bytes = relay_id->toBinary(
false);
637 if (bytes.size() > 0) {
638 upgraded->set(
"relay-id",
645 .arg(lease->addr_.toText());
648 mutable_isc->remove(
"relay-agent-info");
649 removed_extended_info =
true;
660 verifying =
"sub-options";
662 mutable_isc->remove(
"relay-agent-info");
663 removed_extended_info =
true;
666 string rai_hex = sub_options->stringValue();
667 vector<uint8_t> rai_data;
673 verifying =
"remote-id";
675 mutable_isc->remove(
"relay-agent-info");
676 removed_extended_info =
true;
679 string remote_id_hex = remote_id->stringValue();
680 vector<uint8_t> remote_id_data;
682 if (remote_id_data.empty()) {
683 mutable_isc->remove(
"relay-agent-info");
684 removed_extended_info =
true;
691 verifying =
"relay-id";
693 mutable_isc->remove(
"relay-agent-info");
694 removed_extended_info =
true;
697 string relay_id_hex = relay_id->stringValue();
698 vector<uint8_t> relay_id_data;
700 if (relay_id_data.empty()) {
701 mutable_isc->remove(
"relay-agent-info");
702 removed_extended_info =
true;
711 verifying =
"relay-agent-info";
712 for (
auto const& elem : extended_info->mapValue()) {
713 if ((elem.first !=
"sub-options") &&
714 (elem.first !=
"remote-id") &&
715 (elem.first !=
"relay-id") &&
716 (elem.first !=
"comment")) {
717 mutable_isc->remove(
"relay-agent-info");
718 removed_extended_info =
true;
720 "' entry in relay-agent-info");
725 }
catch (
const exception& ex) {
727 err <<
"in " << verifying <<
" a problem was found: " << ex.what();
729 .arg(lease->addr_.toText())
733 if (verifying ==
"user context") {
735 }
else if (verifying ==
"isc") {
736 mutable_user_context->remove(
"ISC");
737 if (mutable_user_context->empty()) {
741 if (!removed_extended_info) {
742 mutable_isc->remove(
"relay-agent-info");
744 if (mutable_isc->empty()) {
745 mutable_user_context->remove(
"ISC");
746 if (mutable_user_context->empty()) {
758 bool changed =
false;
776 string verifying =
"";
777 bool removed_relay_info =
false;
778 bool upgraded =
false;
779 bool have_both =
false;
783 verifying =
"user context";
787 if (user_context->empty()) {
794 isc = user_context->get(
"ISC");
798 mutable_user_context =
799 boost::const_pointer_cast<Element>(user_context);
800 if (!mutable_user_context) {
802 mutable_user_context =
copy(user_context, 0);
803 lease->setContext(mutable_user_context);
811 mutable_user_context->remove(
"ISC");
812 if (mutable_user_context->empty()) {
817 mutable_isc = boost::const_pointer_cast<Element>(
isc);
821 mutable_user_context->set(
"ISC", mutable_isc);
824 relay_info = mutable_isc->get(
"relays");
825 if (relay_info &&
isc->contains(
"relay-info")) {
827 mutable_isc->remove(
"relays");
835 verifying =
"relays";
836 mutable_isc->set(
"relay-info", relay_info);
837 mutable_isc->remove(
"relays");
840 mutable_isc->remove(
"relay-info");
841 removed_relay_info =
true;
844 if (relay_info->empty()) {
845 mutable_isc->remove(
"relay-info");
846 removed_relay_info =
true;
851 for (i = 0; i < relay_info->size(); ++i) {
852 ElementPtr relay = relay_info->getNonConst(i);
854 mutable_isc->remove(
"relay-info");
855 removed_relay_info =
true;
859 mutable_isc->remove(
"relay-info");
860 removed_relay_info =
true;
870 verifying =
"options";
872 mutable_isc->remove(
"relay-info");
873 removed_relay_info =
true;
876 string options_hex = options->stringValue();
877 vector<uint8_t> options_data;
883 if (remote_id_it != opts.end()) {
884 OptionPtr remote_id = remote_id_it->second;
886 vector<uint8_t> bytes = remote_id->toBinary();
887 if (bytes.size() > 0) {
888 relay->set(
"remote-id",
895 if (relay_id_it != opts.end()) {
896 OptionPtr relay_id = relay_id_it->second;
898 vector<uint8_t> bytes = relay_id->toBinary(
false);
899 if (bytes.size() > 0) {
900 relay->set(
"relay-id",
908 verifying = (upgraded ?
"relays" :
"relay-info");
910 relay_info = mutable_isc->get(
"relay-info");
915 mutable_isc->remove(
"relay-info");
916 removed_relay_info =
true;
919 if (!upgraded && relay_info->empty()) {
920 mutable_isc->remove(
"relay-info");
921 removed_relay_info =
true;
926 for (i = 0; i < relay_info->size(); ++i) {
927 ElementPtr relay = relay_info->getNonConst(i);
928 if (!upgraded && !relay) {
929 mutable_isc->remove(
"relay-info");
930 removed_relay_info =
true;
934 mutable_isc->remove(
"relay-info");
935 removed_relay_info =
true;
940 if (!upgraded && options) {
942 verifying =
"options";
944 mutable_isc->remove(
"relay-info");
945 removed_relay_info =
true;
948 string options_hex = options->stringValue();
949 vector<uint8_t> options_data;
961 mutable_isc->remove(
"relay-info");
962 removed_relay_info =
true;
966 mutable_isc->remove(
"relay-info");
967 removed_relay_info =
true;
970 IOAddress laddr(link_addr->stringValue());
972 mutable_isc->remove(
"relay-info");
973 removed_relay_info =
true;
978 if (!upgraded && remote_id) {
979 verifying =
"remote-id";
981 mutable_isc->remove(
"relay-info");
982 removed_relay_info =
true;
985 string remote_id_hex = remote_id->stringValue();
986 vector<uint8_t> remote_id_data;
988 if (remote_id_data.empty()) {
989 mutable_isc->remove(
"relay-info");
990 removed_relay_info =
true;
996 if (!upgraded && relay_id) {
997 verifying =
"relay-id";
999 mutable_isc->remove(
"relay-info");
1000 removed_relay_info =
true;
1003 string relay_id_hex = relay_id->stringValue();
1004 vector<uint8_t> relay_id_data;
1006 if (relay_id_data.empty()) {
1007 mutable_isc->remove(
"relay-info");
1008 removed_relay_info =
true;
1020 mutable_isc->remove(
"relay-info");
1021 removed_relay_info =
true;
1025 mutable_isc->remove(
"relay-info");
1026 removed_relay_info =
true;
1029 IOAddress paddr(peer_addr->stringValue());
1030 if (!paddr.isV6()) {
1031 mutable_isc->remove(
"relay-info");
1032 removed_relay_info =
true;
1039 mutable_isc->remove(
"relay-info");
1040 removed_relay_info =
true;
1044 mutable_isc->remove(
"relay-info");
1045 removed_relay_info =
true;
1049 verifying = (upgraded ?
"relays" :
"relay-info");
1050 for (
auto const& elem : relay->mapValue()) {
1051 if ((elem.first !=
"hop") &&
1052 (elem.first !=
"link") &&
1053 (elem.first !=
"peer") &&
1054 (elem.first !=
"options") &&
1055 (elem.first !=
"remote-id") &&
1056 (elem.first !=
"relay-id") &&
1057 (elem.first !=
"comment")) {
1058 mutable_isc->remove(
"relay-info");
1059 removed_relay_info =
true;
1068 .arg(lease->addr_.toText());
1072 }
catch (
const exception& ex) {
1074 err <<
"in " << verifying;
1076 err <<
" [relay#" << i <<
"]";
1078 err <<
" a problem was found: " << ex.what();
1080 .arg(lease->addr_.toText())
1084 have_both = !have_both;
1085 if (verifying ==
"user context") {
1087 }
else if (verifying ==
"isc") {
1088 mutable_user_context->remove(
"ISC");
1089 if (mutable_user_context->empty()) {
1093 if (!removed_relay_info) {
1094 mutable_isc->remove(
"relay-info");
1096 if (mutable_isc->empty()) {
1097 mutable_user_context->remove(
"ISC");
1098 if (mutable_user_context->empty()) {
1109 bool ignore_errors) {
1115 if (!user_context) {
1119 if (ignore_errors) {
1124 if (user_context->empty()) {
1133 if (ignore_errors) {
1143 if (!extended_info) {
1147 if (ignore_errors) {
1152 if (extended_info->empty()) {
1159 vector<uint8_t> bytes;
1164 if (!ignore_errors) {
1168 lease->relay_id_ = bytes;
1169 }
else if (!ignore_errors) {
1177 vector<uint8_t> bytes;
1182 if (!ignore_errors) {
1186 lease->remote_id_ = bytes;
1187 }
else if (!ignore_errors) {
1202 if (!user_context || (user_context->getType() !=
Element::map) ||
1203 user_context->empty()) {
1213 if (!relay_info || (relay_info->getType() !=
Element::list) ||
1214 relay_info->empty()) {
1218 for (
int i = 0; i < relay_info->size(); ++i) {
1220 if (!relay || (relay->getType() !=
Element::map) || relay->empty()) {
1226 string relay_id_hex = relay_id->stringValue();
1227 vector<uint8_t> relay_id_data;
1229 if (relay_id_data.empty()) {
1238 string remote_id_hex = remote_id->stringValue();
1239 vector<uint8_t> remote_id_data;
1241 if (remote_id_data.empty()) {
1247 }
catch (
const exception&) {
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 when a function is not implemented.
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
The IOAddress class represents an IP addresses (version agnostic)
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
Multiple lease records found where one expected.
ExtendedInfoSanity
Values for extended info sanity checks done for leases.
@ EXTENDED_INFO_CHECK_PEDANTIC
@ EXTENDED_INFO_CHECK_FIX
@ EXTENDED_INFO_CHECK_NONE
static CfgMgr & instance()
returns a single instance of Configuration Manager
Holds DUID (DHCPv6 Unique Identifier)
std::string toText() const
Returns textual representation of the identifier (e.g.
virtual LeaseStatsQueryPtr startSubnetLeaseStatsQuery6(const SubnetID &subnet_id)
Creates and runs the IPv6 lease stats query for a single subnet.
virtual LeaseStatsQueryPtr startPoolLeaseStatsQuery6()
Creates and runs the IPv6 lease stats query for all subnets and pools.
virtual Lease6Collection getLeases6() const =0
Returns all IPv6 leases.
void recountLeaseStats6()
Recalculates per-subnet and global stats for IPv6 leases.
void setExtendedInfoTablesEnabled(const bool enabled)
Modifies the setting whether the lease6 extended info tables are enabled.
virtual size_t byRelayId6size() const
Return the by-relay-id table size.
static bool upgradeLease6ExtendedInfo(const Lease6Ptr &lease, CfgConsistency::ExtendedInfoSanity check=CfgConsistency::EXTENDED_INFO_CHECK_FIX)
Upgrade a V6 lease user context to the new extended info entry.
virtual size_t byRemoteId6size() const
Return the by-remote-id table size.
virtual void addRelayId6(const isc::asiolink::IOAddress &lease_addr, const std::vector< uint8_t > &relay_id)=0
Add lease6 extended info into by-relay-id table.
virtual LeaseStatsQueryPtr startSubnetRangeLeaseStatsQuery4(const SubnetID &first_subnet_id, const SubnetID &last_subnet_id)
Creates and runs the IPv4 lease stats query for a single subnet.
void recountLeaseStats4()
Recalculates per-subnet and global stats for IPv4 leases.
static std::string getDBVersion()
Class method to return extended version info This class method must be redeclared and redefined in de...
virtual LeaseStatsQueryPtr startSubnetRangeLeaseStatsQuery6(const SubnetID &first_subnet_id, const SubnetID &last_subnet_id)
Creates and runs the IPv6 lease stats query for a single subnet.
virtual LeaseStatsQueryPtr startSubnetLeaseStatsQuery4(const SubnetID &subnet_id)
Creates and runs the IPv4 lease stats query for a single subnet.
virtual Lease6Ptr getLease6(Lease::Type type, const isc::asiolink::IOAddress &addr) const =0
Returns existing IPv6 lease for a given IPv6 address.
virtual LeaseStatsQueryPtr startLeaseStatsQuery4()
Creates and runs the IPv4 lease stats query for all subnets.
static void extractLease4ExtendedInfo(const Lease4Ptr &lease, bool ignore_errors=true)
Extract relay and remote identifiers from the extended info.
static bool upgradeLease4ExtendedInfo(const Lease4Ptr &lease, CfgConsistency::ExtendedInfoSanity check=CfgConsistency::EXTENDED_INFO_CHECK_FIX)
The following queries are used to fulfill Bulk Lease Query queries.
virtual void addRemoteId6(const isc::asiolink::IOAddress &lease_addr, const std::vector< uint8_t > &remote_id)=0
Add lease6 extended info into by-remote-id table.
virtual LeaseStatsQueryPtr startPoolLeaseStatsQuery4()
Creates and runs the IPv4 lease stats query for all subnets and pools.
virtual bool addExtendedInfo6(const Lease6Ptr &lease)
Extract extended info from a lease6 and add it into tables.
virtual LeaseStatsQueryPtr startLeaseStatsQuery6()
Creates and runs the IPv6 lease stats query for all subnets.
const size_t page_size_
Holds page size.
LeasePageSize(const size_t page_size)
Constructor.
LeaseStatsQuery(const SelectMode &select_mode=ALL_SUBNETS)
Constructor to query statistics for all subnets.
SubnetID first_subnet_id_
First (or only) subnet_id in the selection criteria.
SubnetID last_subnet_id_
Last subnet_id in the selection criteria when a range is given.
virtual bool getNextRow(LeaseStatsRow &row)
Fetches the next row of data.
SelectMode
Defines the types of selection criteria supported.
static const OptionDefinition & DHO_DHCP_AGENT_OPTIONS_DEF()
Get definition of DHO_DHCP_AGENT_OPTIONS option.
static size_t unpackOptions6(const OptionBuffer &buf, const std::string &option_space, isc::dhcp::OptionCollection &options, size_t *relay_msg_offset=0, size_t *relay_msg_len=0)
Parses provided buffer as DHCPv6 options and creates Option objects.
Option with defined data fields represented as buffers that can be accessed using data field index.
Base class representing a DHCP option definition.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
An abstract API for lease database.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
ElementPtr copy(ConstElementPtr from, int level)
Copy the data up to a nesting level.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
const isc::log::MessageID DHCPSRV_LEASE6_EXTENDED_INFO_UPGRADED
boost::shared_ptr< OptionCustom > OptionCustomPtr
A pointer to the OptionCustom object.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
std::vector< Lease6Ptr > Lease6Collection
A collection of IPv6 leases.
boost::shared_ptr< LeaseStatsQuery > LeaseStatsQueryPtr
Defines a pointer to a LeaseStatsQuery.
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.
std::multimap< unsigned int, OptionPtr > OptionCollection
A collection of DHCP (v4 or v6) options.
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.
const isc::log::MessageID DHCPSRV_LEASE4_EXTENDED_INFO_SANITY_FAIL
const isc::log::MessageID DHCPSRV_LEASE4_EXTENDED_INFO_UPGRADED
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
const int DHCPSRV_DBG_TRACE
DHCP server library logging levels.
boost::shared_ptr< Option > OptionPtr
const isc::log::MessageID DHCPSRV_LEASE6_EXTENDED_INFO_SANITY_FAIL
void decodeHex(const string &encoded_str, vector< uint8_t > &output)
Decode a base16 encoded string into binary data.
string encodeHex(const vector< uint8_t > &binary)
Encode binary data in the base16 format.
void decodeFormattedHexString(const string &hex_string, vector< uint8_t > &binary)
Converts a formatted string of hexadecimal digits into a vector.
Defines the logger used by the top-level component of kea-lfc.
#define DHCP6_OPTION_SPACE
Contains a single row of lease statistical data.
static const uint32_t STATE_DEFAULT
A lease in the default state.
static const uint32_t STATE_DECLINED
Declined lease.
Type
Type of lease or pool.
@ TYPE_PD
the lease contains IPv6 prefix (for prefix delegation)
@ TYPE_NA
the lease contains non-temporary IPv6 address