Kea 2.7.6
|
Local class for conversion of void pointers to function pointers. More...
#include <pointer_converter.h>
Public Member Functions | |
PointerConverter (CalloutPtr callout_ptr) | |
Constructor. | |
PointerConverter (void *dlsym_ptr) | |
Constructor. | |
Pointer accessor functions | |
It is up to the caller to ensure that the correct member is called so that the correct type of pointer is returned. | |
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 | unloadPtr () const |
Return pointer to unload function. | |
version_function_ptr | versionPtr () const |
Return pointer to version function. | |
multi_threading_compatible_function_ptr | multiThreadingCompatiblePtr () const |
Return pointer to multi_threading_compatible function. | |
Local class for conversion of void pointers to function pointers.
Converting between void* and function pointers in C++ is fraught with difficulty and pitfalls, e.g. see https://groups.google.com/forum/?hl=en&fromgroups#!topic/comp.lang.c++/37o0l8rtEE0
The method given in that article - convert using a union is used here. A union is declared (and zeroed) and the appropriate member extracted when needed.
Definition at line 25 of file pointer_converter.h.
|
inline |
Constructor.
Zeroes the union and stores the void* pointer we wish to convert (the one returned by dlsym).
dlsym_ptr | void* pointer returned by call to dlsym() |
Definition at line 33 of file pointer_converter.h.
References dlsym_ptr.
|
inline |
Constructor.
Zeroes the union and stores the CalloutPtr pointer we wish to convert. This constructor is used in debug messages; output of a pointer to an object (including to a function) is, on some compilers, printed as "1".
callout_ptr | Pointer to callout function |
Definition at line 46 of file pointer_converter.h.
References callout_ptr.
|
inline |
Return pointer to callout function.
Definition at line 70 of file pointer_converter.h.
Referenced by isc::hooks::LibraryManager::registerStandardCallouts().
|
inline |
Return pointer returned by dlsym call.
Definition at line 63 of file pointer_converter.h.
Referenced by isc::hooks::CalloutManager::callCallouts().
|
inline |
Return pointer to load function.
Definition at line 77 of file pointer_converter.h.
Referenced by isc::hooks::LibraryManager::runLoad().
|
inline |
Return pointer to multi_threading_compatible function.
Definition at line 98 of file pointer_converter.h.
Referenced by isc::hooks::LibraryManager::checkMultiThreadingCompatible().
|
inline |
Return pointer to unload function.
Definition at line 84 of file pointer_converter.h.
Referenced by isc::hooks::LibraryManager::prepareUnloadLibrary().
|
inline |
Return pointer to version function.
Definition at line 91 of file pointer_converter.h.
Referenced by isc::hooks::LibraryManager::checkVersion().
CalloutPtr isc::hooks::PointerConverter::callout_ptr |
Definition at line 109 of file pointer_converter.h.
Referenced by PointerConverter().
void* isc::hooks::PointerConverter::dlsym_ptr |
Definition at line 108 of file pointer_converter.h.
Referenced by PointerConverter().
load_function_ptr isc::hooks::PointerConverter::load_ptr |
Definition at line 110 of file pointer_converter.h.
multi_threading_compatible_function_ptr isc::hooks::PointerConverter::multi_threading_compatible_ptr |
Definition at line 113 of file pointer_converter.h.
unload_function_ptr isc::hooks::PointerConverter::unload_ptr |
Definition at line 111 of file pointer_converter.h.
version_function_ptr isc::hooks::PointerConverter::version_ptr |
Definition at line 112 of file pointer_converter.h.