Kea 2.6.0
cfg_globals.h
Go to the documentation of this file.
1// Copyright (C) 2021-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef CFG_GLOBALS_H
8#define CFG_GLOBALS_H
9
10#include <cc/cfg_to_element.h>
11#include <cc/data.h>
12#include <boost/shared_ptr.hpp>
13#include <map>
14#include <string>
15#include <vector>
16
17namespace isc {
18namespace dhcp {
19
26public:
27
29
39 enum Index : int {
40 // Common parameters.
84
85 // DHCPv4 specific parameters.
94
95 // DHCPv6 specific parameters.
102
103 // Size sentinel.
104 SIZE
105 };
106
108 static const std::map<std::string, int> nameToIndex;
109
111
115 CfgGlobals();
116
122 isc::data::ConstElementPtr get(const std::string& name) const;
123
129 isc::data::ConstElementPtr get(int index) const;
130
136 void set(const std::string& name, isc::data::ConstElementPtr value);
137
143 void set(int index, isc::data::ConstElementPtr value);
144
146 void clear();
147
149 typedef std::map<std::string, isc::data::ConstElementPtr> MapType;
150
155 const MapType valuesMap() const;
156
161
162protected:
164 std::vector<isc::data::ConstElementPtr> values_;
165};
166
168typedef boost::shared_ptr<CfgGlobals> CfgGlobalsPtr;
169
171typedef boost::shared_ptr<const CfgGlobals> ConstCfgGlobalsPtr;
172
173} // namespace isc::dhcp
174} // namespace isc
175
176#endif // CFG_GLOBALS_H
Class to store configured global parameters.
Definition: cfg_globals.h:25
void clear()
Clear configured parameter values.
Definition: cfg_globals.cc:159
void set(const std::string &name, isc::data::ConstElementPtr value)
Set a configured parameter value by name.
Definition: cfg_globals.cc:141
const MapType valuesMap() const
Returns configured parameters as a map.
Definition: cfg_globals.cc:168
CfgGlobals()
Instance members.
Definition: cfg_globals.cc:120
static const std::map< std::string, int > nameToIndex
Name to index map.
Definition: cfg_globals.h:108
std::map< std::string, isc::data::ConstElementPtr > MapType
Type of name and value map.
Definition: cfg_globals.h:149
isc::data::ElementPtr toElement() const
Unparse configured global parameters.
Definition: cfg_globals.cc:181
isc::data::ConstElementPtr get(const std::string &name) const
Get a configured parameter value by name.
Definition: cfg_globals.cc:124
std::vector< isc::data::ConstElementPtr > values_
Vectors of values.
Definition: cfg_globals.h:164
Index
Class members.
Definition: cfg_globals.h:39
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:29
boost::shared_ptr< Element > ElementPtr
Definition: data.h:28
boost::shared_ptr< const CfgGlobals > ConstCfgGlobalsPtr
Const shared pointer to a CfgGlobals instance.
Definition: cfg_globals.h:171
boost::shared_ptr< CfgGlobals > CfgGlobalsPtr
Non-const shared pointer to a CfgGlobals instance.
Definition: cfg_globals.h:168
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.