Kea  1.5.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 
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 
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 
100 private:
103 };
104 
105 };
106 };
107 
108 #endif // HOOKS_CONFIG_H
isc::hooks::InvalidHooksLibraries
Exception thrown when a library failed to validate.
Definition: hooks_config.h:19
isc::hooks::HooksConfig::verifyLibraries
void verifyLibraries(const isc::data::Element::Position &position) const
Verifies that libraries stored in libraries_ are valid.
Definition: hooks_config.cc:20
libinfo.h
isc::data::CfgToElement
Abstract class for configuration Cfg_* classes.
Definition: cfg_to_element.h:29
isc::hooks::HooksConfig::equal
bool equal(const HooksConfig &other) const
Compares two Hooks Config classes for equality.
Definition: hooks_config.cc:67
isc::hooks::InvalidHooksLibraries::InvalidHooksLibraries
InvalidHooksLibraries(const char *file, size_t line, const char *what)
Definition: hooks_config.h:21
isc::hooks::HooksConfig::get
const isc::hooks::HookLibsCollection & get() const
Provides access to the configured hooks libraries.
Definition: hooks_config.h:54
isc::Exception
This is a base class for exceptions thrown from the DNS library module.
Definition: exceptions/exceptions.h:23
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition: exceptions/exceptions.cc:32
isc::hooks::HooksConfig
Wrapper class that holds hooks libraries configuration.
Definition: hooks_config.h:36
isc::hooks::HooksConfig::loadLibraries
void loadLibraries() const
Commits hooks libraries configuration.
Definition: hooks_config.cc:55
isc::data::Element::Position
Represents the position of the data element within a configuration string.
Definition: data.h:88
isc::hooks::HooksConfig::HooksConfig
HooksConfig()
Default constructor.
Definition: hooks_config.h:40
cfg_to_element.h
isc::hooks::HooksConfig::clear
void clear()
Removes all configured hooks libraries.
Definition: hooks_config.h:59
isc::hooks::HooksConfig::toElement
isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: hooks_config.cc:106
data.h
exceptions.h
isc::hooks::HooksConfig::add
void add(std::string libname, isc::data::ConstElementPtr parameters)
Adds additional hooks libraries.
Definition: hooks_config.h:46
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition: data.h:20
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
isc::hooks::HookLibsCollection
std::vector< HookLibInfo > HookLibsCollection
A storage for information about hook libraries.
Definition: libinfo.h:31