OptionDefinitionPtr getOptionDef4(const ServerSelector& server_selector,
const uint16_t code,
const std::string& space) {
-
- if (server_selector.amUnassigned()) {
- isc_throw(NotImplemented, "managing configuration for no particular server"
- " (unassigned) is unsupported at the moment");
- }
-
- auto tag = getServerTag(server_selector, "fetching option definition");
-
- OptionDefContainer option_defs;
- MySqlBindingCollection in_bindings = {
- MySqlBinding::createString(tag),
- MySqlBinding::createInteger<uint8_t>(static_cast<uint8_t>(code)),
- MySqlBinding::createString(space)
- };
- getOptionDefs(GET_OPTION_DEF4_CODE_SPACE, in_bindings, option_defs);
- return (option_defs.empty() ? OptionDefinitionPtr() : *option_defs.begin());
+ return (getOptionDef(GET_OPTION_DEF4_CODE_SPACE, server_selector, code, space));
}
/// @brief Sends query to retrieve all option definitions.
void
getAllOptionDefs4(const ServerSelector& server_selector,
OptionDefContainer& option_defs) {
- auto tags = getServerTags(server_selector);
- for (auto tag : tags) {
- MySqlBindingCollection in_bindings = {
- MySqlBinding::createString(tag)
- };
- getOptionDefs(MySqlConfigBackendDHCPv4Impl::GET_ALL_OPTION_DEFS4,
- in_bindings, option_defs);
- }
+ getAllOptionDefs(MySqlConfigBackendDHCPv4Impl::GET_ALL_OPTION_DEFS4,
+ server_selector, option_defs);
}
/// @brief Sends query to retrieve option definitions with modification
getModifiedOptionDefs4(const ServerSelector& server_selector,
const boost::posix_time::ptime& modification_time,
OptionDefContainer& option_defs) {
- auto tags = getServerTags(server_selector);
- for (auto tag : tags) {
- MySqlBindingCollection in_bindings = {
- MySqlBinding::createString(tag),
- MySqlBinding::createTimestamp(modification_time)
- };
- getOptionDefs(MySqlConfigBackendDHCPv4Impl::GET_MODIFIED_OPTION_DEFS4,
- in_bindings, option_defs);
- }
+ getModifiedOptionDefs(MySqlConfigBackendDHCPv4Impl::GET_MODIFIED_OPTION_DEFS4,
+ server_selector, modification_time, option_defs);
}
/// @brief Sends query to retrieve single global option by code and
});
}
+OptionDefinitionPtr
+MySqlConfigBackendImpl::getOptionDef(const int index,
+ const ServerSelector& server_selector,
+ const uint16_t code,
+ const std::string& space) {
+
+ if (server_selector.amUnassigned()) {
+ isc_throw(NotImplemented, "managing configuration for no particular server"
+ " (unassigned) is unsupported at the moment");
+ }
+
+ auto tag = getServerTag(server_selector, "fetching option definition");
+
+ OptionDefContainer option_defs;
+ MySqlBindingCollection in_bindings = {
+ MySqlBinding::createString(tag),
+ MySqlBinding::createInteger<uint16_t>(code),
+ MySqlBinding::createString(space)
+ };
+ getOptionDefs(index, in_bindings, option_defs);
+ return (option_defs.empty() ? OptionDefinitionPtr() : *option_defs.begin());
+}
+
+void
+MySqlConfigBackendImpl::getAllOptionDefs(const int index,
+ const ServerSelector& server_selector,
+ OptionDefContainer& option_defs) {
+ auto tags = getServerTags(server_selector);
+ for (auto tag : tags) {
+ MySqlBindingCollection in_bindings = {
+ MySqlBinding::createString(tag)
+ };
+ getOptionDefs(index, in_bindings, option_defs);
+ }
+}
+
+void
+MySqlConfigBackendImpl::getModifiedOptionDefs(const int index,
+ const ServerSelector& server_selector,
+ const boost::posix_time::ptime& modification_time,
+ OptionDefContainer& option_defs) {
+ auto tags = getServerTags(server_selector);
+ for (auto tag : tags) {
+ MySqlBindingCollection in_bindings = {
+ MySqlBinding::createString(tag),
+ MySqlBinding::createTimestamp(modification_time)
+ };
+ getOptionDefs(index, in_bindings, option_defs);
+ }
+}
+
void
MySqlConfigBackendImpl::getOptionDefs(const int index,
const MySqlBindingCollection& in_bindings,
const db::MySqlBindingCollection& in_bindings,
data::StampedValueCollection& parameters);
+ /// @brief Sends query to retrieve single option definition by code and
+ /// option space.
+ ///
+ /// @param index Index of the query to be used.
+ /// @param server_selector Server selector.
+ /// @param code Option code.
+ /// @param space Option space name.
+ ///
+ /// @return Pointer to the returned option definition or NULL if such
+ /// option definition doesn't exist.
+ OptionDefinitionPtr getOptionDef(const int index,
+ const db::ServerSelector& server_selector,
+ const uint16_t code,
+ const std::string& space);
+
+ /// @brief Sends query to retrieve all option definitions.
+ ///
+ /// @param index Index of the query to be used.
+ /// @param server_selector Server selector.
+ /// @param [out] option_defs Reference to the container where option
+ /// definitions are to be stored.
+ void getAllOptionDefs(const int index,
+ const db::ServerSelector& server_selector,
+ OptionDefContainer& option_defs);
+
+ /// @brief Sends query to retrieve option definitions with modification
+ /// time later than specified timestamp.
+ ///
+ /// @param index Index of the query to be used.
+ /// @param server_selector Server selector.
+ /// @param modification_time Lower bound subnet modification time.
+ /// @param [out] option_defs Reference to the container where option
+ /// definitions are to be stored.
+ void getModifiedOptionDefs(const int index,
+ const db::ServerSelector& server_selector,
+ const boost::posix_time::ptime& modification_time,
+ OptionDefContainer& option_defs);
+
/// @brief Sends query to the database to retrieve multiple option
/// definitions.
///