Kea 2.5.8
hooks_config.h
Go to the documentation of this file.
1// Copyright (C) 2017-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 HOOKS_CONFIG_H
8#define HOOKS_CONFIG_H
9
11#include <cc/data.h>
12#include <cc/cfg_to_element.h>
13#include <hooks/libinfo.h>
14
15namespace isc {
16namespace hooks {
17
20 public:
21 InvalidHooksLibraries(const char* file, size_t line, const char* what) :
22 isc::Exception(file, line, what) { };
23};
24
37public:
40 HooksConfig() : libraries_() { }
41
46 void add(std::string libname, isc::data::ConstElementPtr parameters) {
47 libraries_.push_back(make_pair(libname, parameters));
48 }
49
55 return libraries_;
56 }
57
59 void clear() {
60 libraries_.clear();
61 }
62
66 bool equal(const HooksConfig& other) const;
67
80 bool multi_threading_enabled) const;
81
94 void loadLibraries(bool multi_threading_enabled) const;
95
106
107private:
110};
111
112} // namespace hooks
113} // namespace isc
114
115#endif // HOOKS_CONFIG_H
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Wrapper class that holds hooks libraries configuration.
Definition: hooks_config.h:36
void clear()
Removes all configured hooks libraries.
Definition: hooks_config.h:59
bool equal(const HooksConfig &other) const
Compares two Hooks Config classes for equality.
Definition: hooks_config.cc:69
const isc::hooks::HookLibsCollection & get() const
Provides access to the configured hooks libraries.
Definition: hooks_config.h:54
void verifyLibraries(const isc::data::Element::Position &position, bool multi_threading_enabled) const
Verifies that libraries stored in libraries_ are valid.
Definition: hooks_config.cc:20
isc::data::ElementPtr toElement() const
Unparse a configuration object.
HooksConfig()
Default constructor.
Definition: hooks_config.h:40
void add(std::string libname, isc::data::ConstElementPtr parameters)
Adds additional hooks libraries.
Definition: hooks_config.h:46
void loadLibraries(bool multi_threading_enabled) const
Commits hooks libraries configuration.
Definition: hooks_config.cc:57
Exception thrown when a library failed to validate.
Definition: hooks_config.h:19
InvalidHooksLibraries(const char *file, size_t line, const char *what)
Definition: hooks_config.h:21
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:29
boost::shared_ptr< Element > ElementPtr
Definition: data.h:28
std::vector< HookLibInfo > HookLibsCollection
A storage for information about hook libraries.
Definition: libinfo.h:31
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
Represents the position of the data element within a configuration string.
Definition: data.h:94