Kea 2.7.5
pointer_converter.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 POINTER_CONVERTER_H
8#define POINTER_CONVERTER_H
9
10#include <hooks/hooks.h>
11
12namespace isc {
13namespace hooks {
14
24
26public:
34 memset(&pointers_, 0, sizeof(pointers_));
35 pointers_.dlsym_ptr = dlsym_ptr;
36 }
37
47 memset(&pointers_, 0, sizeof(pointers_));
48 pointers_.callout_ptr = callout_ptr;
49 }
50
57
63 void* dlsymPtr() const {
64 return (pointers_.dlsym_ptr);
65 }
66
71 return (pointers_.callout_ptr);
72 }
73
77 load_function_ptr loadPtr() const {
78 return (pointers_.load_ptr);
79 }
80
84 unload_function_ptr unloadPtr() const {
85 return (pointers_.unload_ptr);
86 }
87
91 version_function_ptr versionPtr() const {
92 return (pointers_.version_ptr);
93 }
94
98 multi_threading_compatible_function_ptr multiThreadingCompatiblePtr() const {
99 return (pointers_.multi_threading_compatible_ptr);
100 }
101
103
104private:
105
107 union {
108 void* dlsym_ptr; // void* returned by dlsym
109 CalloutPtr callout_ptr; // Pointer to callout
110 load_function_ptr load_ptr; // Pointer to load function
111 unload_function_ptr unload_ptr; // Pointer to unload function
112 version_function_ptr version_ptr; // Pointer to version function
113 multi_threading_compatible_function_ptr multi_threading_compatible_ptr;
114 // Pointer to multi_threading_compatible function
115 } pointers_;
116};
117
118} // namespace hooks
119} // namespace isc
120
121
122#endif // POINTER_CONVERTER_H
Local class for conversion of void pointers to function pointers.
PointerConverter(void *dlsym_ptr)
Constructor.
multi_threading_compatible_function_ptr multiThreadingCompatiblePtr() const
Return pointer to multi_threading_compatible function.
PointerConverter(CalloutPtr callout_ptr)
Constructor.
version_function_ptr version_ptr
unload_function_ptr unloadPtr() const
Return pointer to unload function.
version_function_ptr versionPtr() const
Return pointer to version function.
void * dlsymPtr() const
Return pointer returned by dlsym call.
CalloutPtr calloutPtr() const
Return pointer to callout function.
load_function_ptr loadPtr() const
Return pointer to load function.
multi_threading_compatible_function_ptr multi_threading_compatible_ptr
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.