Kea 1.5.0
pointer_converter.h
Go to the documentation of this file.
1// Copyright (C) 2013-2015 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
96
97private:
98
100 union {
101 void* dlsym_ptr; // void* returned by dlsym
102 CalloutPtr callout_ptr; // Pointer to callout
103 load_function_ptr load_ptr; // Pointer to load function
104 unload_function_ptr unload_ptr; // Pointer to unload function
105 version_function_ptr version_ptr; // Pointer to version function
106 } pointers_;
107};
108
109} // namespace hooks
110} // namespace isc
111
112
113#endif // POINTER_CONVERTER_H
Local class for conversion of void pointers to function pointers.
PointerConverter(void *dlsym_ptr)
Constructor.
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.
unload_function_ptr unload_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-dhcp-ddns.