Kea 2.7.6
library_handle.h
Go to the documentation of this file.
1// Copyright (C) 2013-2024 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
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
211private:
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
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.
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.
bool deregisterCallout(const std::string &name, CalloutPtr callout)
De-Register a callout on a hook.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
int(* CalloutPtr)(CalloutHandle &)
Typedef for a callout pointer. (Callouts must have "C" linkage.)
Defines the logger used by the top-level component of kea-lfc.