Kea  2.3.3-git
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 
10 #include <exceptions/exceptions.h>
11 #include <cc/data.h>
12 #include <cc/cfg_to_element.h>
13 #include <hooks/libinfo.h>
14 
15 namespace isc {
16 namespace hooks {
17 
20  public:
21  InvalidHooksLibraries(const char* file, size_t line, const char* what) :
22  isc::Exception(file, line, what) { };
23 };
24 
37 public:
40  HooksConfig() : libraries_() { }
41 
46  void add(std::string libname, isc::data::ConstElementPtr parameters) {
47  libraries_.push_back(make_pair(libname, parameters));
48  }
49 
54  const isc::hooks::HookLibsCollection& get() const {
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 
98  isc::data::ElementPtr toElement() const;
99 
100 private:
103 };
104 
105 };
106 };
107 
108 #endif // HOOKS_CONFIG_H
HooksConfig()
Default constructor.
Definition: hooks_config.h:40
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
Wrapper class that holds hooks libraries configuration.
Definition: hooks_config.h:36
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
std::vector< HookLibInfo > HookLibsCollection
A storage for information about hook libraries.
Definition: libinfo.h:31
void clear()
Removes all configured hooks libraries.
Definition: hooks_config.h:59
Abstract class for configuration Cfg_* classes.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
Represents the position of the data element within a configuration string.
Definition: data.h:92
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-lfc.
void add(std::string libname, isc::data::ConstElementPtr parameters)
Adds additional hooks libraries.
Definition: hooks_config.h:46
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