2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-03 15:35:17 +00:00

[4097a] Switched class iterators

This commit is contained in:
Francis Dupont
2015-11-20 16:29:10 +01:00
parent 92b4df9e90
commit b66c0b8cff
2 changed files with 16 additions and 9 deletions

View File

@@ -2371,18 +2371,19 @@ Dhcpv4Srv::classSpecificProcessing(const Dhcpv4Exchange& ex) {
rsp->setSiaddr(IOAddress::IPV4_ZERO_ADDRESS()); rsp->setSiaddr(IOAddress::IPV4_ZERO_ADDRESS());
} }
// Process each class // Process each class in the packet
const ClientClassDefMapPtr& defs_ptr = CfgMgr::instance().getCurrentCfg()-> const ClientClasses& classes = query->getClasses();
getClientClassDictionary()->getClasses(); for (ClientClasses::const_iterator cclass = classes.begin();
for (ClientClassDefMap::const_iterator it = defs_ptr->begin(); cclass != classes.end(); ++cclass) {
it != defs_ptr->end(); ++it) { // Find the client class definition for this class
// Is the query in this class? const ClientClassDefPtr& ccdef = CfgMgr::instance().getCurrentCfg()->
if (!it->second || !query->inClass(it->first)) { getClientClassDictionary()->findClass(*cclass);
if (!ccdef) {
// Not found
continue; continue;
} }
// Get the configured options of this class // Get the configured options of this class
const OptionContainerPtr& options = const OptionContainerPtr& options = ccdef->getCfgOption()->getAll("dhcp4");
it->second->getCfgOption()->getAll("dhcp4");
if (!options || options->empty()) { if (!options || options->empty()) {
continue; continue;
} }

View File

@@ -237,6 +237,12 @@ public:
/// @param client_class name of the class to be added /// @param client_class name of the class to be added
void addClass(const isc::dhcp::ClientClass& client_class); void addClass(const isc::dhcp::ClientClass& client_class);
/// @brief Returns the class set
///
/// @note This should be used only to iterate over the class set.
/// @return
const ClientClasses& getClasses() const { return (classes_); }
/// @brief Unparsed data (in received packets). /// @brief Unparsed data (in received packets).
/// ///
/// @warning This public member is accessed by derived /// @warning This public member is accessed by derived