rlm_eap: add eap_chbind.c to build
[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 #ifndef FR_MODPRIV_H
6 #define FR_MODPRIV_H
7
8 #include <freeradius-devel/radiusd.h>
9 #include <freeradius-devel/modules.h>
10
11 /*
12  *      Using the native dlopen() API means that we don't want to use libltdl.
13  */
14 #ifdef WITH_DLOPEN
15 #define WITHOUT_LIBLTDL
16 #endif
17
18 #ifndef WITHOUT_LIBLTDL
19 #ifdef WITH_SYSTEM_LTDL
20 #include "ltdl.h"
21 #else
22 #include "libltdl/ltdl.h"
23 #endif
24 #endif
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 #ifdef WITHOUT_LIBLTDL
31 typedef void *lt_dlhandle;
32
33 int lt_dlinit(void);
34 lt_dlhandle lt_dlopenext(const char *name);
35 void *lt_dlsym(lt_dlhandle handle, const char *symbol);
36 int lt_dlclose(lt_dlhandle handle);
37 const char *lt_dlerror(void);
38
39 #define LTDL_SET_PRELOADED_SYMBOLS(_x)
40 #define lt_dlexit(_x)
41 #define lt_dlsetsearchpath(_x)
42 #endif
43
44 /*
45  *      Keep track of which modules we've loaded.
46  */
47 typedef struct module_entry_t {
48         char                    name[MAX_STRING_LEN];
49         const module_t          *module;
50         lt_dlhandle             handle;
51 } module_entry_t;
52
53 typedef struct fr_module_hup_t fr_module_hup_t;
54
55 /*
56  *      Per-instance data structure, to correlate the modules
57  *      with the instance names (may NOT be the module names!),
58  *      and the per-instance data structures.
59  */
60 typedef struct module_instance_t {
61         char                    name[MAX_STRING_LEN];
62         module_entry_t          *entry;
63         void                    *insthandle;
64 #ifdef HAVE_PTHREAD_H
65         pthread_mutex_t         *mutex;
66 #endif
67         CONF_SECTION            *cs;
68         int                     dead;
69         fr_module_hup_t         *mh;
70 } module_instance_t;
71
72 module_instance_t *find_module_instance(CONF_SECTION *, const char *instname,
73                                         int do_link);
74 int module_hup_module(CONF_SECTION *cs, module_instance_t *node, time_t when);
75
76 #ifdef __cplusplus
77 }
78 #endif
79
80 #endif  /* FR_MODPRIV_H */