]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#103,!289] Added indexes by option id for.
authorMarcin Siodelski <marcin@isc.org>
Wed, 3 Apr 2019 19:07:34 +0000 (21:07 +0200)
committerMarcin Siodelski <marcin@isc.org>
Wed, 10 Apr 2019 14:57:43 +0000 (16:57 +0200)
src/lib/dhcp/option_definition.h
src/lib/dhcp/option_space_container.h
src/lib/dhcpsrv/cfg_option.h

index 2d05c7dfa55b2a42496f155cb07d3baf18e38b14..f644e6efb0e5654d61f6af22cc78ec8ad2384a4d 100644 (file)
@@ -822,6 +822,13 @@ typedef boost::multi_index_container<
                 boost::posix_time::ptime,
                 &data::StampedElement::getModificationTime
             >
+        >,
+        // Start definition of index #4.
+        // Use StampedElement::getId as a key.
+        boost::multi_index::hashed_non_unique<
+            boost::multi_index::tag<OptionIdIndexTag>,
+            boost::multi_index::const_mem_fun<data::StampedElement, uint64_t,
+                                              &data::StampedElement::getId>
         >
     >
 > OptionDefContainer;
index 8a7736f46daa0ae6d7863e9713350861ca33c517..4f54bb0cf34e4d9a6eb85b3b255bfafe46211e48 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -13,6 +13,9 @@
 namespace isc {
 namespace dhcp {
 
+/// @brief A tag for accessing DHCP options and definitions by id.
+struct OptionIdIndexTag { };
+
 /// @brief Simple container for option spaces holding various items.
 ///
 /// This helper class is used to store items of various types
index cfe7b5f70351a4edc116a99f98999394eb68dcab..bd54ff59bd826a1d15478660c2275025afe81b3b 100644 (file)
@@ -211,6 +211,14 @@ typedef boost::multi_index_container<
                 boost::posix_time::ptime,
                 &data::StampedElement::getModificationTime
             >
+        >,
+
+        // Start definition of index #4.
+        // Use StampedElement::getId as a key.
+        boost::multi_index::hashed_non_unique<
+            boost::multi_index::tag<OptionIdIndexTag>,
+            boost::multi_index::const_mem_fun<data::StampedElement, uint64_t,
+                                              &data::StampedElement::getId>
         >
     >
 > OptionContainer;