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
13namespace isc {
14namespace hooks {
15
16// Forward declarations
17class CalloutHandle;
18class CalloutManager;
19
21extern "C" {
22 typedef int (*CalloutPtr)(CalloutHandle&);
23};
24
59
61public:
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
208private:
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
Per-packet callout handle.
void registerCallout(const std::string &name, CalloutPtr callout)
Register a callout on a hook.
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.
std::vector< std::string > getParameterNames()
Returns names of configuration parameters for the library.
LibraryHandle(CalloutManager *manager, int index=-1)
Constructor.
void registerCommandCallout(const std::string &command_name, CalloutPtr callout)
Register control command handler.
bool deregisterCallout(const std::string &name, CalloutPtr callout)
De-Register a callout on a hook.
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
int(* CalloutPtr)(CalloutHandle &)
Typedef for a callout pointer. (Callouts must have "C" linkage.)
Defines the logger used by the top-level component of kea-dhcp-ddns.