Kea 2.5.4
cfg_globals.h
Go to the documentation of this file.
1// Copyright (C) 2021-2023 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.
78
79 // DHCPv4 specific parameters.
87
88 // DHCPv6 specific parameters.
94
95 // Size sentinel.
96 SIZE
97 };
98
100 static const std::map<std::string, int> nameToIndex;
101
103
107 CfgGlobals();
108
114 isc::data::ConstElementPtr get(const std::string& name) const;
115
121 isc::data::ConstElementPtr get(int index) const;
122
128 void set(const std::string& name, isc::data::ConstElementPtr value);
129
135 void set(int index, isc::data::ConstElementPtr value);
136
138 void clear();
139
141 typedef std::map<std::string, isc::data::ConstElementPtr> MapType;
142
147 const MapType valuesMap() const;
148
153
154protected:
156 std::vector<isc::data::ConstElementPtr> values_;
157};
158
160typedef boost::shared_ptr<CfgGlobals> CfgGlobalsPtr;
161
163typedef boost::shared_ptr<const CfgGlobals> ConstCfgGlobalsPtr;
164
165} // namespace isc::dhcp
166} // namespace isc
167
168#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:152
void set(const std::string &name, isc::data::ConstElementPtr value)
Set a configured parameter value by name.
Definition: cfg_globals.cc:134
const MapType valuesMap() const
Returns configured parameters as a map.
Definition: cfg_globals.cc:161
CfgGlobals()
Instance members.
Definition: cfg_globals.cc:113
static const std::map< std::string, int > nameToIndex
Name to index map.
Definition: cfg_globals.h:100
std::map< std::string, isc::data::ConstElementPtr > MapType
Type of name and value map.
Definition: cfg_globals.h:141
isc::data::ElementPtr toElement() const
Unparse configured global parameters.
Definition: cfg_globals.cc:174
isc::data::ConstElementPtr get(const std::string &name) const
Get a configured parameter value by name.
Definition: cfg_globals.cc:117
std::vector< isc::data::ConstElementPtr > values_
Vectors of values.
Definition: cfg_globals.h:156
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:163
boost::shared_ptr< CfgGlobals > CfgGlobalsPtr
Non-const shared pointer to a CfgGlobals instance.
Definition: cfg_globals.h:160
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.