Kea 2.2.0
hooks_config.h
Go to the documentation of this file.
1// Copyright (C) 2017 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
76 void verifyLibraries(const isc::data::Element::Position& position) const;
77
87 void loadLibraries() const;
88
99
100private:
103};
104
105};
106};
107
108#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:67
const isc::hooks::HookLibsCollection & get() const
Provides access to the configured hooks libraries.
Definition: hooks_config.h:54
isc::data::ElementPtr toElement() const
Unparse a configuration object.
void verifyLibraries(const isc::data::Element::Position &position) const
Verifies that libraries stored in libraries_ are valid.
Definition: hooks_config.cc:20
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() const
Commits hooks libraries configuration.
Definition: hooks_config.cc:55
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:27
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
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:92