MySqlTransaction transaction(conn_);
OptionDescriptorPtr existing_option =
- getOption(GET_OPTION4_POOL_ID_CODE_SPACE, Option::V4,
- server_selector, pool_id,
- option->option_->getType(),
- option->space_name_);
+ getOption(GET_OPTION4_POOL_ID_CODE_SPACE,
+ server_selector, Lease::TYPE_V4, pool_id,
+ option->option_->getType(), option->space_name_);
// Create scoped audit revision. As long as this instance exists
// no new audit revisions are created in any subsequent calls.
OptionDescriptorPtr
MySqlConfigBackendImpl::getOption(const int index,
- const Option::Universe& universe,
const ServerSelector& server_selector,
+ const Lease::Type pool_type,
const uint64_t pool_id,
const uint16_t code,
const std::string& space) {
" (unassigned) is unsupported at the moment");
}
- auto tag = getServerTag(server_selector, "fetching [pd] pool level option");
+ std::string msg = "fetching ";
+ if (pool_type == Lease::TYPE_PD) {
+ msg += "prefix delegation";
+ } else {
+ msg += "address";
+ }
+ msg += " pool level option";
+ auto tag = getServerTag(server_selector, msg);
+ Option::Universe universe = Option::V4;
OptionContainer options;
MySqlBindingCollection in_bindings;
in_bindings.push_back(MySqlBinding::createString(tag));
in_bindings.push_back(MySqlBinding::createInteger<uint64_t>(pool_id));
- if (universe == Option::V4) {
+ if (pool_type == Lease::TYPE_V4) {
in_bindings.push_back(MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)));
} else {
in_bindings.push_back(MySqlBinding::createInteger<uint16_t>(code));
+ universe =Option::V6;
}
in_bindings.push_back(MySqlBinding::createString(space));
getOptions(index, in_bindings, universe, options);
#include <dhcp/option.h>
#include <dhcp/option_definition.h>
#include <dhcpsrv/cfg_option.h>
+#include <dhcpsrv/lease.h>
#include <dhcpsrv/network.h>
#include <dhcpsrv/subnet_id.h>
#include <exceptions/exceptions.h>
/// for a given address or prefix delegation (v6) pool id.
///
/// @param index Index of the query to be used.
- /// @param universe Option universe, i.e. V4 or V6.
/// @param server_selector Server selector.
+ /// @param pool_type Pool type (Lease::TYPE_V4, TYPE_NA or TYPE_PD).
/// @param pool_id Pool identifier in the database.
/// @param code Option code.
/// @param space Option space name.
/// @return Pointer to the returned option descriptor or NULL if such
/// option doesn't exist.
OptionDescriptorPtr getOption(const int index,
- const Option::Universe& universe,
const db::ServerSelector& server_selector,
+ const dhcp::Lease::Type pool_type,
const uint64_t pool_id,
const uint16_t code,
const std::string& space);