Kea  1.5.0
library_handle.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2018 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 LIBRARY_HANDLE_H
8 #define LIBRARY_HANDLE_H
9 
10 #include <string>
11 #include <cc/data.h>
12 
13 namespace isc {
14 namespace hooks {
15 
16 // Forward declarations
17 class CalloutHandle;
18 class CalloutManager;
19 
21 extern "C" {
22  typedef int (*CalloutPtr)(CalloutHandle&);
23 };
24 
59 
61 public:
62 
80  LibraryHandle(CalloutManager* manager, int index = -1)
81  : callout_manager_(manager), index_(index)
82  {}
83 
96  void registerCallout(const std::string& name, CalloutPtr callout);
97 
107  void registerCommandCallout(const std::string& command_name, CalloutPtr callout);
108 
123  bool deregisterCallout(const std::string& name, CalloutPtr callout);
124 
136  bool deregisterAllCallouts(const std::string& name);
137 
138 
199  getParameter(const std::string& name);
200 
206  std::vector<std::string> getParameterNames();
207 
208 private:
219 
226  LibraryHandle& operator=(const LibraryHandle&);
227 
231  isc::data::ConstElementPtr getParameters();
232 
234  CalloutManager* callout_manager_;
235 
238  int index_;
239 };
240 
241 } // namespace util
242 } // namespace isc
243 
244 #endif // LIBRARY_HANDLE_H
isc::hooks::LibraryHandle::LibraryHandle
LibraryHandle(CalloutManager *manager, int index=-1)
Constructor.
Definition: library_handle.h:80
isc::hooks::CalloutHandle
Per-packet callout handle.
Definition: callout_handle.h:84
isc::hooks::CalloutManager
Callout Manager.
Definition: callout_manager.h:134
isc::hooks::LibraryHandle
Library handle.
Definition: library_handle.h:60
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::hooks::LibraryHandle::getParameterNames
std::vector< std::string > getParameterNames()
Returns names of configuration parameters for the library.
Definition: library_handle.cc:122
isc::hooks::LibraryHandle::getParameter
isc::data::ConstElementPtr getParameter(const std::string &name)
Returns configuration parameter for the library.
Definition: library_handle.cc:110
isc::hooks::CalloutPtr
int(* CalloutPtr)(CalloutHandle &)
Typedef for a callout pointer. (Callouts must have "C" linkage.)
Definition: library_handle.h:22
data.h
isc::hooks::LibraryHandle::registerCommandCallout
void registerCommandCallout(const std::string &command_name, CalloutPtr callout)
Register control command handler.
Definition: library_handle.cc:41
isc::hooks::LibraryHandle::registerCallout
void registerCallout(const std::string &name, CalloutPtr callout)
Register a callout on a hook.
Definition: library_handle.cc:21
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
isc::hooks::LibraryHandle::deregisterCallout
bool deregisterCallout(const std::string &name, CalloutPtr callout)
De-Register a callout on a hook.
Definition: library_handle.cc:51
isc::hooks::LibraryHandle::deregisterAllCallouts
bool deregisterAllCallouts(const std::string &name)
Removes all callouts on a hook.
Definition: library_handle.cc:67