Commit cc6c0d30 authored by Razvan Becheriu's avatar Razvan Becheriu

[#1044] consistent logging, doxygen and minor changes

parent 6cf65c34
......@@ -20,7 +20,7 @@
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <limits>
#include <sstream>
#include <string>
#include <time.h>
......@@ -1725,7 +1725,7 @@ MySqlLeaseMgr::MySqlLeaseContextAlloc::~MySqlLeaseContextAlloc() {
MySqlLeaseMgr::MySqlLeaseMgr(const MySqlConnection::ParameterMap& parameters)
: parameters_(parameters) {
// Test schema version.
// Validate schema version first.
std::pair<uint32_t, uint32_t> code_version(MYSQL_SCHEMA_VERSION_MAJOR,
MYSQL_SCHEMA_VERSION_MINOR);
std::pair<uint32_t, uint32_t> db_version = getVersion();
......@@ -1821,7 +1821,8 @@ MySqlLeaseMgr::addLeaseCommon(MySqlLeaseContextPtr ctx,
bool
MySqlLeaseMgr::addLease(const Lease4Ptr& lease) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_ADD_ADDR4).arg(lease->addr_.toText());
DHCPSRV_MYSQL_ADD_ADDR4)
.arg(lease->addr_.toText());
// Get a context
MySqlLeaseContextAlloc get_context(*this);
......@@ -1837,7 +1838,8 @@ MySqlLeaseMgr::addLease(const Lease4Ptr& lease) {
bool
MySqlLeaseMgr::addLease(const Lease6Ptr& lease) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_ADD_ADDR6).arg(lease->addr_.toText())
DHCPSRV_MYSQL_ADD_ADDR6)
.arg(lease->addr_.toText())
.arg(lease->type_);
// Get a context
......@@ -1985,7 +1987,8 @@ void MySqlLeaseMgr::getLease(MySqlLeaseContextPtr ctx,
Lease4Ptr
MySqlLeaseMgr::getLease4(const isc::asiolink::IOAddress& addr) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_ADDR4).arg(addr.toText());
DHCPSRV_MYSQL_GET_ADDR4)
.arg(addr.toText());
// Set up the WHERE clause value
MYSQL_BIND inbind[1];
......@@ -2011,7 +2014,8 @@ MySqlLeaseMgr::getLease4(const isc::asiolink::IOAddress& addr) const {
Lease4Collection
MySqlLeaseMgr::getLease4(const HWAddr& hwaddr) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_HWADDR).arg(hwaddr.toText());
DHCPSRV_MYSQL_GET_HWADDR)
.arg(hwaddr.toText());
// Set up the WHERE clause value
MYSQL_BIND inbind[1];
......@@ -2053,7 +2057,8 @@ Lease4Ptr
MySqlLeaseMgr::getLease4(const HWAddr& hwaddr, SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_SUBID_HWADDR)
.arg(subnet_id).arg(hwaddr.toText());
.arg(subnet_id)
.arg(hwaddr.toText());
// Set up the WHERE clause value
MYSQL_BIND inbind[2];
......@@ -2098,7 +2103,8 @@ MySqlLeaseMgr::getLease4(const HWAddr& hwaddr, SubnetID subnet_id) const {
Lease4Collection
MySqlLeaseMgr::getLease4(const ClientId& clientid) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_CLIENTID).arg(clientid.toText());
DHCPSRV_MYSQL_GET_CLIENTID)
.arg(clientid.toText());
// Set up the WHERE clause value
MYSQL_BIND inbind[1];
......@@ -2145,7 +2151,8 @@ Lease4Ptr
MySqlLeaseMgr::getLease4(const ClientId& clientid, SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_SUBID_CLIENTID)
.arg(subnet_id).arg(clientid.toText());
.arg(subnet_id)
.arg(clientid.toText());
// Set up the WHERE clause value
MYSQL_BIND inbind[2];
......@@ -2184,8 +2191,9 @@ MySqlLeaseMgr::getLease4(const ClientId& clientid, SubnetID subnet_id) const {
Lease4Collection
MySqlLeaseMgr::getLeases4(SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_SUBID4)
.arg(subnet_id);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_SUBID4)
.arg(subnet_id);
// Set up the WHERE clause value
MYSQL_BIND inbind[1];
......@@ -2210,8 +2218,9 @@ MySqlLeaseMgr::getLeases4(SubnetID subnet_id) const {
Lease4Collection
MySqlLeaseMgr::getLeases4(const string& hostname) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_HOSTNAME4)
.arg(hostname);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_HOSTNAME4)
.arg(hostname);
// Set up the WHERE clause value
MYSQL_BIND inbind[1];
......@@ -2236,7 +2245,8 @@ MySqlLeaseMgr::getLeases4(const string& hostname) const {
Lease4Collection
MySqlLeaseMgr::getLeases4() const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET4);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET4);
Lease4Collection result;
......@@ -2259,9 +2269,10 @@ MySqlLeaseMgr::getLeases4(const asiolink::IOAddress& lower_bound_address,
<< lower_bound_address);
}
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_PAGE4)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText());
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_PAGE4)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText());
// Prepare WHERE clause
MYSQL_BIND inbind[2];
......@@ -2295,7 +2306,8 @@ Lease6Ptr
MySqlLeaseMgr::getLease6(Lease::Type lease_type,
const isc::asiolink::IOAddress& addr) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_ADDR6).arg(addr.toText())
DHCPSRV_MYSQL_GET_ADDR6)
.arg(addr.toText())
.arg(lease_type);
// Set up the WHERE clause value
......@@ -2329,10 +2341,12 @@ MySqlLeaseMgr::getLease6(Lease::Type lease_type,
}
Lease6Collection
MySqlLeaseMgr::getLeases6(Lease::Type lease_type,
const DUID& duid, uint32_t iaid) const {
MySqlLeaseMgr::getLeases6(Lease::Type lease_type, const DUID& duid,
uint32_t iaid) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_IAID_DUID).arg(iaid).arg(duid.toText())
DHCPSRV_MYSQL_GET_IAID_DUID)
.arg(iaid)
.arg(duid.toText())
.arg(lease_type);
// Set up the WHERE clause value
......@@ -2391,12 +2405,13 @@ MySqlLeaseMgr::getLeases6(Lease::Type lease_type,
}
Lease6Collection
MySqlLeaseMgr::getLeases6(Lease::Type lease_type,
const DUID& duid, uint32_t iaid,
SubnetID subnet_id) const {
MySqlLeaseMgr::getLeases6(Lease::Type lease_type, const DUID& duid,
uint32_t iaid, SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_IAID_SUBID_DUID)
.arg(iaid).arg(subnet_id).arg(duid.toText())
.arg(iaid)
.arg(subnet_id)
.arg(duid.toText())
.arg(lease_type);
// Set up the WHERE clause value
......@@ -2442,8 +2457,9 @@ MySqlLeaseMgr::getLeases6(Lease::Type lease_type,
Lease6Collection
MySqlLeaseMgr::getLeases6(SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_SUBID6)
.arg(subnet_id);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_SUBID6)
.arg(subnet_id);
// Set up the WHERE clause value
MYSQL_BIND inbind[1];
......@@ -2468,7 +2484,8 @@ MySqlLeaseMgr::getLeases6(SubnetID subnet_id) const {
Lease6Collection
MySqlLeaseMgr::getLeases6() const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET6);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET6);
Lease6Collection result;
......@@ -2483,8 +2500,9 @@ MySqlLeaseMgr::getLeases6() const {
Lease6Collection
MySqlLeaseMgr::getLeases6(const DUID& duid) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_DUID)
.arg(duid.toText());
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_DUID)
.arg(duid.toText());
// Set up the WHERE clause value
MYSQL_BIND inbind[1];
......@@ -2512,8 +2530,9 @@ MySqlLeaseMgr::getLeases6(const DUID& duid) const {
Lease6Collection
MySqlLeaseMgr::getLeases6(const string& hostname) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_HOSTNAME6)
.arg(hostname);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_HOSTNAME6)
.arg(hostname);
// Set up the WHERE clause value
MYSQL_BIND inbind[1];
......@@ -2546,9 +2565,10 @@ MySqlLeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
<< lower_bound_address);
}
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_PAGE6)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText());
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_PAGE6)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText());
// Prepare WHERE clause
MYSQL_BIND inbind[2];
......@@ -2590,16 +2610,18 @@ MySqlLeaseMgr::getLeases6(const asiolink::IOAddress& lower_bound_address,
void
MySqlLeaseMgr::getExpiredLeases4(Lease4Collection& expired_leases,
const size_t max_leases) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_EXPIRED4)
.arg(max_leases);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_EXPIRED4)
.arg(max_leases);
getExpiredLeasesCommon(expired_leases, max_leases, GET_LEASE4_EXPIRE);
}
void
MySqlLeaseMgr::getExpiredLeases6(Lease6Collection& expired_leases,
const size_t max_leases) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_GET_EXPIRED6)
.arg(max_leases);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_GET_EXPIRED6)
.arg(max_leases);
getExpiredLeasesCommon(expired_leases, max_leases, GET_LEASE6_EXPIRE);
}
......@@ -2678,7 +2700,8 @@ MySqlLeaseMgr::updateLease4(const Lease4Ptr& lease) {
const StatementIndex stindex = UPDATE_LEASE4;
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_UPDATE_ADDR4).arg(lease->addr_.toText());
DHCPSRV_MYSQL_UPDATE_ADDR4)
.arg(lease->addr_.toText());
// Get a context
MySqlLeaseContextAlloc get_context(*this);
......@@ -2706,7 +2729,8 @@ MySqlLeaseMgr::updateLease6(const Lease6Ptr& lease) {
const StatementIndex stindex = UPDATE_LEASE6;
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_UPDATE_ADDR6).arg(lease->addr_.toText())
DHCPSRV_MYSQL_UPDATE_ADDR6)
.arg(lease->addr_.toText())
.arg(lease->type_);
// Get a context
......@@ -2763,7 +2787,8 @@ MySqlLeaseMgr::deleteLeaseCommon(StatementIndex stindex, MYSQL_BIND* bind) {
bool
MySqlLeaseMgr::deleteLease(const isc::asiolink::IOAddress& addr) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_DELETE_ADDR).arg(addr.toText());
DHCPSRV_MYSQL_DELETE_ADDR)
.arg(addr.toText());
// Set up the WHERE clause value
MYSQL_BIND inbind[1];
......@@ -2797,7 +2822,7 @@ uint64_t
MySqlLeaseMgr::deleteExpiredReclaimedLeases4(const uint32_t secs) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED4)
.arg(secs);
.arg(secs);
return (deleteExpiredReclaimedLeasesCommon(secs, DELETE_LEASE4_STATE_EXPIRED));
}
......@@ -2805,7 +2830,7 @@ uint64_t
MySqlLeaseMgr::deleteExpiredReclaimedLeases6(const uint32_t secs) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_DELETE_EXPIRED_RECLAIMED6)
.arg(secs);
.arg(secs);
return (deleteExpiredReclaimedLeasesCommon(secs, DELETE_LEASE6_STATE_EXPIRED));
}
......@@ -2833,7 +2858,7 @@ MySqlLeaseMgr::deleteExpiredReclaimedLeasesCommon(const uint32_t secs,
uint64_t deleted_leases = deleteLeaseCommon(statement_index, inbind);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_DELETED_EXPIRED_RECLAIMED)
.arg(deleted_leases);
.arg(deleted_leases);
return (deleted_leases);
}
......@@ -2867,7 +2892,7 @@ MySqlLeaseMgr::startSubnetLeaseStatsQuery4(const SubnetID& subnet_id) {
LeaseStatsQueryPtr
MySqlLeaseMgr::startSubnetRangeLeaseStatsQuery4(const SubnetID& first_subnet_id,
const SubnetID& last_subnet_id) {
const SubnetID& last_subnet_id) {
// Get a context
MySqlLeaseContextAlloc get_context(*this);
MySqlLeaseContextPtr ctx = get_context.ctx_;
......@@ -2910,7 +2935,7 @@ MySqlLeaseMgr::startSubnetLeaseStatsQuery6(const SubnetID& subnet_id) {
LeaseStatsQueryPtr
MySqlLeaseMgr::startSubnetRangeLeaseStatsQuery6(const SubnetID& first_subnet_id,
const SubnetID& last_subnet_id) {
const SubnetID& last_subnet_id) {
// Get a context
MySqlLeaseContextAlloc get_context(*this);
MySqlLeaseContextPtr ctx = get_context.ctx_;
......@@ -2966,12 +2991,14 @@ MySqlLeaseMgr::getVersion() const {
void
MySqlLeaseMgr::commit() {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_COMMIT);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_COMMIT);
}
void
MySqlLeaseMgr::rollback() {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_ROLLBACK);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_MYSQL_ROLLBACK);
}
void
......
......@@ -157,7 +157,6 @@ public:
/// failed.
virtual Lease4Ptr getLease4(const isc::asiolink::IOAddress& addr) const;
/// @brief Returns existing IPv4 leases for specified hardware address.
///
/// Although in the usual case there will be only one lease, for mobile
......@@ -195,7 +194,7 @@ public:
virtual Lease4Ptr getLease4(const isc::dhcp::HWAddr& hwaddr,
SubnetID subnet_id) const;
/// @brief Returns existing IPv4 lease for specified client-id
/// @brief Returns existing IPv4 leases for specified client-id
///
/// Although in the usual case there will be only one lease, for mobile
/// clients or clients with multiple static/fixed/reserved leases there
......@@ -586,7 +585,7 @@ public:
/// @brief Returns backend name.
///
/// Each backend have specific name, e.g. "mysql" or "sqlite".
/// Each backend have specific name.
///
/// @return Name of the backend.
virtual std::string getName() const;
......@@ -625,7 +624,8 @@ public:
/// @brief Statement Tags
///
/// The contents of the enum are indexes into the list of SQL statements
/// The contents of the enum are indexes into the list of compiled SQL
/// statements
enum StatementIndex {
DELETE_LEASE4, // Delete from lease4 by address
DELETE_LEASE4_STATE_EXPIRED, // Delete expired lease4 in a given state
......@@ -692,7 +692,7 @@ private:
/// @param stindex Index of statement being executed
/// @param bind MYSQL_BIND array for input parameters
/// @param exchange Exchange object to use
/// @param lease LeaseCollection object returned. Note that any leases in
/// @param result Returned collection of leases. Note that any leases in
/// the collection when this method is called are not erased: the
/// new data is appended to the end.
/// @param single If true, only a single data item is to be retrieved.
......@@ -706,11 +706,12 @@ private:
/// from the database where only one was expected.
template <typename Exchange, typename LeaseCollection>
void getLeaseCollection(MySqlLeaseContextPtr ctx,
StatementIndex stindex, MYSQL_BIND* bind,
StatementIndex stindex,
MYSQL_BIND* bind,
Exchange& exchange, LeaseCollection& result,
bool single = false) const;
/// @brief Get Lease Collection
/// @brief Get Lease4 Collection
///
/// Gets a collection of Lease4 objects. This is just an interface to
/// the get lease collection common code.
......@@ -728,12 +729,13 @@ private:
/// @throw isc::db::MultipleRecords Multiple records were retrieved
/// from the database where only one was expected.
void getLeaseCollection(MySqlLeaseContextPtr ctx,
StatementIndex stindex, MYSQL_BIND* bind,
StatementIndex stindex,
MYSQL_BIND* bind,
Lease4Collection& result) const {
getLeaseCollection(ctx, stindex, bind, ctx->exchange4_, result);
}
/// @brief Get Lease Collection
/// @brief Get Lease6 Collection
///
/// Gets a collection of Lease6 objects. This is just an interface to
/// the get lease collection common code.
......@@ -750,7 +752,8 @@ private:
/// @throw isc::db::MultipleRecords Multiple records were retrieved
/// from the database where only one was expected.
void getLeaseCollection(MySqlLeaseContextPtr ctx,
StatementIndex stindex, MYSQL_BIND* bind,
StatementIndex stindex,
MYSQL_BIND* bind,
Lease6Collection& result) const {
getLeaseCollection(ctx, stindex, bind, ctx->exchange6_, result);
}
......@@ -766,12 +769,13 @@ private:
/// @param bind MYSQL_BIND array for input parameters
/// @param lease Lease4 object returned
void getLease(MySqlLeaseContextPtr ctx,
StatementIndex stindex, MYSQL_BIND* bind,
StatementIndex stindex,
MYSQL_BIND* bind,
Lease4Ptr& result) const;
/// @brief Get Lease6 Common Code
///
/// This method performs the common actions for the various getLease46)
/// This method performs the common actions for the various getLease4()
/// methods. It acts as an interface to the getLeaseCollection() method,
/// but retrieving only a single lease.
///
......@@ -780,10 +784,10 @@ private:
/// @param bind MYSQL_BIND array for input parameters
/// @param lease Lease6 object returned
void getLease(MySqlLeaseContextPtr ctx,
StatementIndex stindex, MYSQL_BIND* bind,
StatementIndex stindex,
MYSQL_BIND* bind,
Lease6Ptr& result) const;
/// @brief Get expired leases common code.
///
/// This method retrieves expired and not reclaimed leases from the
......@@ -822,7 +826,8 @@ private:
/// failed.
template <typename LeasePtr>
void updateLeaseCommon(MySqlLeaseContextPtr ctx,
StatementIndex stindex, MYSQL_BIND* bind,
StatementIndex stindex,
MYSQL_BIND* bind,
const LeasePtr& lease);
/// @brief Delete lease common code
......@@ -840,7 +845,8 @@ private:
///
/// @throw isc::db::DbOperationError An operation on the open database has
/// failed.
uint64_t deleteLeaseCommon(StatementIndex stindex, MYSQL_BIND* bind);
uint64_t deleteLeaseCommon(StatementIndex stindex,
MYSQL_BIND* bind);
/// @brief Delete expired-reclaimed leases.
///
......
......@@ -309,6 +309,7 @@ PgSqlTaggedStatement tagged_statements[] = {
"hwaddr = $13, hwtype = $14, hwaddr_source = $15, "
"state = $16, user_context = $17 "
"WHERE address = $18"},
// ALL_LEASE4_STATS
{ 0, { OID_NONE },
"all_lease4_stats",
......@@ -420,7 +421,7 @@ private:
public:
/// @brief Default constructor
/// @brief Constructor
PgSqlLease4Exchange()
: lease_(), addr4_(0), hwaddr_length_(0), hwaddr_(hwaddr_length_),
client_id_length_(0) {
......@@ -1139,7 +1140,7 @@ PgSqlLeaseMgr::PgSqlLeaseContextAlloc::PgSqlLeaseContextAlloc(
}
} else {
if (mgr_.pool_->pool_.empty()) {
isc_throw(Unexpected, "No available PgSql lease context?!");
isc_throw(Unexpected, "No available PostgreSQL lease context?!");
}
ctx_ = mgr_.pool_->pool_.back();
}
......@@ -1199,8 +1200,8 @@ PgSqlLeaseMgr::createContext() const {
<< " does not match expected count:" << NUM_STATEMENTS);
}
// Create the exchange objects for use for transfer of data to/from
// the database.
// Create the exchange objects for use in exchanging data between the
// program and the database.
ctx->exchange4_.reset(new PgSqlLease4Exchange());
ctx->exchange6_.reset(new PgSqlLease6Exchange());
......@@ -1235,7 +1236,6 @@ PgSqlLeaseMgr::addLeaseCommon(PgSqlLeaseContextPtr ctx,
if (ctx->conn_.compareError(r, PgSqlConnection::DUPLICATE_KEY)) {
return (false);
}
ctx->conn_.checkStatementError(r, tagged_statements[stindex]);
}
......@@ -1245,7 +1245,8 @@ PgSqlLeaseMgr::addLeaseCommon(PgSqlLeaseContextPtr ctx,
bool
PgSqlLeaseMgr::addLease(const Lease4Ptr& lease) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_ADD_ADDR4).arg(lease->addr_.toText());
DHCPSRV_PGSQL_ADD_ADDR4)
.arg(lease->addr_.toText());
// Get a context
PgSqlLeaseContextAlloc get_context(*this);
......@@ -1259,7 +1260,9 @@ PgSqlLeaseMgr::addLease(const Lease4Ptr& lease) {
bool
PgSqlLeaseMgr::addLease(const Lease6Ptr& lease) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_ADD_ADDR6).arg(lease->addr_.toText());
DHCPSRV_PGSQL_ADD_ADDR6)
.arg(lease->addr_.toText())
.arg(lease->type_);
// Get a context
PgSqlLeaseContextAlloc get_context(*this);
......@@ -1344,7 +1347,8 @@ PgSqlLeaseMgr::getLease(PgSqlLeaseContextPtr ctx,
Lease4Ptr
PgSqlLeaseMgr::getLease4(const isc::asiolink::IOAddress& addr) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_ADDR4).arg(addr.toText());
DHCPSRV_PGSQL_GET_ADDR4)
.arg(addr.toText());
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1369,7 +1373,8 @@ PgSqlLeaseMgr::getLease4(const isc::asiolink::IOAddress& addr) const {
Lease4Collection
PgSqlLeaseMgr::getLease4(const HWAddr& hwaddr) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_HWADDR).arg(hwaddr.toText());
DHCPSRV_PGSQL_GET_HWADDR)
.arg(hwaddr.toText());
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1397,7 +1402,8 @@ Lease4Ptr
PgSqlLeaseMgr::getLease4(const HWAddr& hwaddr, SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_SUBID_HWADDR)
.arg(subnet_id).arg(hwaddr.toText());
.arg(subnet_id)
.arg(hwaddr.toText());
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1428,7 +1434,8 @@ PgSqlLeaseMgr::getLease4(const HWAddr& hwaddr, SubnetID subnet_id) const {
Lease4Collection
PgSqlLeaseMgr::getLease4(const ClientId& clientid) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_CLIENTID).arg(clientid.toText());
DHCPSRV_PGSQL_GET_CLIENTID)
.arg(clientid.toText());
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1462,7 +1469,8 @@ Lease4Ptr
PgSqlLeaseMgr::getLease4(const ClientId& clientid, SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_SUBID_CLIENTID)
.arg(subnet_id).arg(clientid.toText());
.arg(subnet_id)
.arg(clientid.toText());
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1488,8 +1496,9 @@ PgSqlLeaseMgr::getLease4(const ClientId& clientid, SubnetID subnet_id) const {
Lease4Collection
PgSqlLeaseMgr::getLeases4(SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_SUBID4)
.arg(subnet_id);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_SUBID4)
.arg(subnet_id);
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1512,8 +1521,9 @@ PgSqlLeaseMgr::getLeases4(SubnetID subnet_id) const {
Lease4Collection
PgSqlLeaseMgr::getLeases4(const string& hostname) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_HOSTNAME4)
.arg(hostname);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_HOSTNAME4)
.arg(hostname);
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1535,7 +1545,8 @@ PgSqlLeaseMgr::getLeases4(const string& hostname) const {
Lease4Collection
PgSqlLeaseMgr::getLeases4() const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET4);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET4);
// Provide empty binding array because our query has no parameters in
// WHERE clause.
......@@ -1561,9 +1572,10 @@ PgSqlLeaseMgr::getLeases4(const asiolink::IOAddress& lower_bound_address,
<< lower_bound_address);
}
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_PAGE4)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText());
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_PAGE4)
.arg(page_size.page_size_)
.arg(lower_bound_address.toText());
// Prepare WHERE clause
PsqlBindArray bind_array;
......@@ -1592,8 +1604,10 @@ PgSqlLeaseMgr::getLeases4(const asiolink::IOAddress& lower_bound_address,
Lease6Ptr
PgSqlLeaseMgr::getLease6(Lease::Type lease_type,
const isc::asiolink::IOAddress& addr) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_ADDR6)
.arg(addr.toText()).arg(lease_type);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_ADDR6)
.arg(addr.toText())
.arg(lease_type);
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1623,7 +1637,9 @@ PgSqlLeaseMgr::getLeases6(Lease::Type lease_type, const DUID& duid,
uint32_t iaid) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_IAID_DUID)
.arg(iaid).arg(duid.toText()).arg(lease_type);
.arg(iaid)
.arg(duid.toText())
.arg(lease_type);
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1656,7 +1672,10 @@ PgSqlLeaseMgr::getLeases6(Lease::Type lease_type, const DUID& duid,
uint32_t iaid, SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_IAID_SUBID_DUID)
.arg(iaid).arg(subnet_id).arg(duid.toText()).arg(lease_type);
.arg(iaid)
.arg(subnet_id)
.arg(duid.toText())
.arg(lease_type);
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1690,8 +1709,9 @@ PgSqlLeaseMgr::getLeases6(Lease::Type lease_type, const DUID& duid,
Lease6Collection
PgSqlLeaseMgr::getLeases6(SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_SUBID6)
.arg(subnet_id);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_SUBID6)
.arg(subnet_id);
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1737,8 +1757,9 @@ PgSqlLeaseMgr::getLeases6(const DUID& duid) const {
Lease6Collection
PgSqlLeaseMgr::getLeases6(const string& hostname) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET_HOSTNAME6)
.arg(hostname);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET_HOSTNAME6)
.arg(hostname);
// Set up the WHERE clause value
PsqlBindArray bind_array;
......@@ -1760,7 +1781,8 @@ PgSqlLeaseMgr::getLeases6(const string& hostname) const {
Lease6Collection
PgSqlLeaseMgr::getLeases6() const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_PGSQL_GET6);
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
DHCPSRV_PGSQL_GET6);
// Provide empty binding array because our query has no parameters in
// WHERE clause.
...