Compile-time option to build WITHOUT_LIBLTDL.
[freeradius.git] / src / include / modpriv.h
1 /* modpriv.h: Stuff needed by both modules.c and modcall.c, but should not be
2  * accessed from anywhere else.
3  *
4  * Version: $Id$ */
5 #include <freeradius-devel/radiusd.h>
6 #include <freeradius-devel/modules.h>
7
8 #ifndef WITHOUT_LIBLTDL
9 #include "ltdl.h"
10 #else
11 typedef void *lt_dlhandle;
12
13 lt_dlhandle lt_dlopenext(const char *name);
14 void *lt_dlsym(lt_dlhandle handle, const char *symbol);
15
16 #define LTDL_SET_PRELOADED_SYMBOLS(_x)
17 #define lt_dlinit(_x) (0)
18 #define lt_dlclose(_x)
19 #define lt_dlexit(_x)
20 #define lt_dlerror(foo) "Internal error"
21 #define lt_dlsetsearchpath(_x)
22 #endif
23
24 /*
25  *      Keep track of which modules we've loaded.
26  */
27 typedef struct module_entry_t {
28         char                    name[MAX_STRING_LEN];
29         const module_t          *module;
30         lt_dlhandle             handle;
31 } module_entry_t;
32
33 /*
34  *      Per-instance data structure, to correlate the modules
35  *      with the instance names (may NOT be the module names!),
36  *      and the per-instance data structures.
37  */
38 typedef struct module_instance_t {
39         char                    name[MAX_STRING_LEN];
40         module_entry_t          *entry;
41         void                    *insthandle;
42 #ifdef HAVE_PTHREAD_H
43         pthread_mutex_t         *mutex;
44 #endif
45         void                    *old_insthandle[16];
46 } module_instance_t;
47
48 module_instance_t *find_module_instance(CONF_SECTION *, const char *instname);