2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

minor changes

This commit is contained in:
Razvan Becheriu
2018-02-15 10:41:47 +02:00
parent adc1970cd8
commit 761f2823a1
3 changed files with 41 additions and 49 deletions

View File

@@ -471,6 +471,7 @@ public:
bind_[9].is_unsigned = MLM_TRUE;
// bind_[9].is_null = &MLM_FALSE; // commented out for performance
// reasons, see memset() above
// Add the error flags
setErrorIndicators(bind_, error_, LEASE_COLUMNS);
@@ -623,7 +624,10 @@ public:
client_id_buffer_, client_id_length_,
valid_lifetime_, 0, 0, cltt, subnet_id_,
fqdn_fwd_, fqdn_rev_, hostname));
// Set state.
lease->state_ = state_;
return (lease);
}
@@ -648,8 +652,8 @@ private:
// Note: Arrays are declared fixed length for speed of creation
uint32_t addr4_; ///< IPv4 address
MYSQL_BIND bind_[LEASE_COLUMNS]; ///< Bind array
std::string columns_[LEASE_COLUMNS];///< Column names
my_bool error_[LEASE_COLUMNS]; ///< Error array
std::string columns_[LEASE_COLUMNS]; ///< Column names
my_bool error_[LEASE_COLUMNS]; ///< Error array
std::vector<uint8_t> hwaddr_; ///< Hardware address
uint8_t hwaddr_buffer_[HWAddr::MAX_HWADDR_LEN];
///< Hardware address buffer
@@ -673,11 +677,9 @@ private:
///< Client hostname
unsigned long hostname_length_; ///< Client hostname length
uint32_t state_; ///< Lease state
};
/// @brief Exchange MySQL and Lease6 Data
///
/// On any MySQL operation, arrays of MYSQL_BIND structures must be built to
@@ -698,7 +700,7 @@ class MySqlLease6Exchange : public MySqlLeaseExchange {
public:
/// @brief Constructor
///
/// The initialization of the variables here is nonly to satisfy cppcheck -
/// The initialization of the variables here is only to satisfy cppcheck -
/// all variables are initialized/set in the methods before they are used.
MySqlLease6Exchange() : addr6_length_(0), duid_length_(0),
iaid_(0), lease_type_(0), prefixlen_(0),
@@ -981,7 +983,7 @@ public:
// code that explicitly sets is_null is there, but is commented out.
memset(bind_, 0, sizeof(bind_));
// address: varchar(39)
// address: varchar(39)
// A Lease6_ address has a maximum of 39 characters. The array is
// one byte longer than this to guarantee that we can always null
// terminate it whatever is returned.
@@ -1100,6 +1102,7 @@ public:
bind_[15].is_unsigned = MLM_TRUE;
// bind_[15].is_null = &MLM_FALSE; // commented out for performance
// reasons, see memset() above
// Add the error flags
setErrorIndicators(bind_, error_, LEASE_COLUMNS);
@@ -1202,11 +1205,11 @@ private:
// schema.
// Note: arrays are declared fixed length for speed of creation
std::string addr6_; ///< String form of address
char addr6_buffer_[ADDRESS6_TEXT_MAX_LEN + 1]; ///< Character
char addr6_buffer_[ADDRESS6_TEXT_MAX_LEN + 1]; ///< Character
///< array form of V6 address
unsigned long addr6_length_; ///< Length of the address
MYSQL_BIND bind_[LEASE_COLUMNS]; ///< Bind array
std::string columns_[LEASE_COLUMNS];///< Column names
std::string columns_[LEASE_COLUMNS]; ///< Column names
std::vector<uint8_t> duid_; ///< Client identification
uint8_t duid_buffer_[DUID::MAX_DUID_LEN]; ///< Buffer form of DUID
unsigned long duid_length_; ///< Length of the DUID
@@ -1323,7 +1326,6 @@ public:
conn_.checkError(status, statement_index_, "results storage failed");
}
/// @brief Fetches the next row in the result set
///
/// Once the internal result set has been populated by invoking the
@@ -1404,7 +1406,6 @@ MySqlLeaseMgr::MySqlLeaseMgr(const MySqlConnection::ParameterMap& parameters)
exchange6_.reset(new MySqlLease6Exchange());
}
MySqlLeaseMgr::~MySqlLeaseMgr() {
// There is no need to close the database in this destructor: it is
// closed in the destructor of the mysql_ member variable.
@@ -1562,7 +1563,6 @@ void MySqlLeaseMgr::getLeaseCollection(StatementIndex stindex,
}
}
void MySqlLeaseMgr::getLease(StatementIndex stindex, MYSQL_BIND* bind,
Lease4Ptr& result) const {
// Create appropriate collection object and get all leases matching
@@ -1581,7 +1581,6 @@ void MySqlLeaseMgr::getLease(StatementIndex stindex, MYSQL_BIND* bind,
}
}
void MySqlLeaseMgr::getLease(StatementIndex stindex, MYSQL_BIND* bind,
Lease6Ptr& result) const {
// Create appropriate collection object and get all leases matching
@@ -1600,7 +1599,6 @@ void MySqlLeaseMgr::getLease(StatementIndex stindex, MYSQL_BIND* bind,
}
}
// Basic lease access methods. Obtain leases from the database using various
// criteria.
@@ -1625,7 +1623,6 @@ MySqlLeaseMgr::getLease4(const isc::asiolink::IOAddress& addr) const {
return (result);
}
Lease4Collection
MySqlLeaseMgr::getLease4(const HWAddr& hwaddr) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
@@ -1655,7 +1652,6 @@ MySqlLeaseMgr::getLease4(const HWAddr& hwaddr) const {
return (result);
}
Lease4Ptr
MySqlLeaseMgr::getLease4(const HWAddr& hwaddr, SubnetID subnet_id) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
@@ -1690,7 +1686,6 @@ MySqlLeaseMgr::getLease4(const HWAddr& hwaddr, SubnetID subnet_id) const {
return (result);
}
Lease4Collection
MySqlLeaseMgr::getLease4(const ClientId& clientid) const {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
@@ -1815,7 +1810,6 @@ MySqlLeaseMgr::getLease6(Lease::Type lease_type,
return (result);
}
Lease6Collection
MySqlLeaseMgr::getLeases6(Lease::Type lease_type,
const DUID& duid, uint32_t iaid) const {
@@ -1959,8 +1953,6 @@ MySqlLeaseMgr::getExpiredLeasesCommon(LeaseCollection& expired_leases,
getLeaseCollection(statement_index, inbind, expired_leases);
}
// Update lease methods. These comprise common code that handles the actual
// update, and type-specific methods that set up the parameters for the prepared
// statement depending on the type of lease.
@@ -1992,7 +1984,6 @@ MySqlLeaseMgr::updateLeaseCommon(StatementIndex stindex, MYSQL_BIND* bind,
}
}
void
MySqlLeaseMgr::updateLease4(const Lease4Ptr& lease) {
const StatementIndex stindex = UPDATE_LEASE4;
@@ -2017,7 +2008,6 @@ MySqlLeaseMgr::updateLease4(const Lease4Ptr& lease) {
updateLeaseCommon(stindex, &bind[0], lease);
}
void
MySqlLeaseMgr::updateLease6(const Lease6Ptr& lease) {
const StatementIndex stindex = UPDATE_LEASE6;
@@ -2188,13 +2178,11 @@ MySqlLeaseMgr::getName() const {
return (name);
}
std::string
MySqlLeaseMgr::getDescription() const {
return (std::string("MySQL Database"));
}
std::pair<uint32_t, uint32_t>
MySqlLeaseMgr::getVersion() const {
const StatementIndex stindex = GET_VERSION;
@@ -2253,7 +2241,6 @@ MySqlLeaseMgr::commit() {
}
}
void
MySqlLeaseMgr::rollback() {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_MYSQL_ROLLBACK);