Kea  1.9.9-git
library_handle.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2020 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 
77  LibraryHandle(CalloutManager& manager, int index = -1)
78  : callout_manager_(manager), index_(index) {}
79 
92  void registerCallout(const std::string& name, CalloutPtr callout);
93 
103  void registerCommandCallout(const std::string& command_name, CalloutPtr callout);
104 
119  bool deregisterCallout(const std::string& name, CalloutPtr callout);
120 
132  bool deregisterAllCallouts(const std::string& name);
133 
134 
195  getParameter(const std::string& name);
196 
201 
209  std::vector<std::string> getParameterNames();
210 
211 private:
222 
229  LibraryHandle& operator=(const LibraryHandle&);
230 
232  CalloutManager& callout_manager_;
233 
236  int index_;
237 };
238 
239 } // namespace util
240 } // namespace isc
241 
242 #endif // LIBRARY_HANDLE_H
std::vector< std::string > getParameterNames()
Returns names of configuration parameters for the library.
int(* CalloutPtr)(CalloutHandle &)
Typedef for a callout pointer. (Callouts must have "C" linkage.)
bool deregisterCallout(const std::string &name, CalloutPtr callout)
De-Register a callout on a hook.
void registerCommandCallout(const std::string &command_name, CalloutPtr callout)
Register control command handler.
LibraryHandle(CalloutManager &manager, int index=-1)
Constructor.
isc::data::ConstElementPtr getParameters()
Get configuration parameter common code.
Per-packet callout handle.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
void registerCallout(const std::string &name, CalloutPtr callout)
Register a callout on a hook.
Defines the logger used by the top-level component of kea-dhcp-ddns.
bool deregisterAllCallouts(const std::string &name)
Removes all callouts on a hook.
isc::data::ConstElementPtr getParameter(const std::string &name)
Returns configuration parameter for the library.