1 /* 2 Copyright (c) 2004, 2021, Oracle and/or its affiliates. 3 All rights reserved. Use is subject to license terms. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License, version 2.0, 7 as published by the Free Software Foundation. 8 9 This program is also distributed with certain software (including 10 but not limited to OpenSSL) that is licensed under separate terms, 11 as designated in a particular file or component or in included license 12 documentation. The authors of MySQL hereby grant you an additional 13 permission to link the program and your derivative works with the 14 separately licensed software that they have included with MySQL. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License, version 2.0, for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program; if not, write to the Free Software 23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 */ 25 26 #ifndef MGMAPI_CONFIGURATION_HPP 27 #define MGMAPI_CONFIGURATION_HPP 28 29 #include <ConfigValues.hpp> 30 31 struct ndb_mgm_configuration { 32 ConfigValues m_config; 33 }; 34 35 /** 36 This is a struct for navigating in the set of configuration values. Each 37 configuration value belongs to a section instance, and each section instance 38 is an instance of a section type. 39 This struct lets you iterate over the instances of a given section type, and 40 then lookup configuration values within the current section instance. 41 */ 42 struct ndb_mgm_configuration_iterator { 43 Uint32 m_sectionNo; 44 Uint32 m_typeOfSection; 45 ConfigValues::ConstIterator m_config; 46 47 ndb_mgm_configuration_iterator(const ndb_mgm_configuration &, unsigned type); 48 49 /** 50 Go to the first section instance. Return 0 if successful, i.e. if there is 51 at least one instance. 52 */ 53 int first(); 54 55 /** Go to the next instance. Return 0 if there was a next instance. */ 56 int next(); 57 58 /** 59 Return 0 if there is a valid current instance (i.e. if the last first() or 60 next() call succeeded). 61 */ 62 int valid() const; 63 64 /** 65 Search for a configuration value with type='Int' id='param' and 66 value='value'. If no match is found in the current section instance, 67 try the next until we have tried the last section. Return 0 if a match 68 was found. 69 Note: This method may change the current section (i.e. call next()). 70 */ 71 int find(int param, unsigned value); 72 73 /** 74 Lookup config value within current section. Return 0 if and only if 75 value was found. 76 */ 77 int get(int param, unsigned * value) const ; 78 int get(int param, Uint64 * value) const ; 79 int get(int param, const char ** value) const ; 80 81 private: 82 void reset(); 83 int enter(); 84 }; 85 86 #endif 87