Wrap header file in protective #ifdef
[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 #ifndef WITHOUT_LIBLTDL
12 #include "ltdl.h"
13 #else
14 typedef void *lt_dlhandle;
15
16 lt_dlhandle lt_dlopenext(const char *name);
17 void *lt_dlsym(lt_dlhandle handle, const char *symbol);
18 int lt_dlclose(lt_dlhandle handle);
19 const char *lt_dlerror(void);
20
21 #define LTDL_SET_PRELOADED_SYMBOLS(_x)
22 #define lt_dlinit(_x) (0)
23 #define lt_dlexit(_x)
24 #define lt_dlsetsearchpath(_x)
25 #endif
26
27 /*
28  *      Keep track of which modules we've loaded.
29  */
30 typedef struct module_entry_t {
31         char                    name[MAX_STRING_LEN];
32         const module_t          *module;
33         lt_dlhandle             handle;
34 } module_entry_t;
35
36 typedef struct fr_module_hup_t fr_module_hup_t;
37
38 /*
39  *      Per-instance data structure, to correlate the modules
40  *      with the instance names (may NOT be the module names!),
41  *      and the per-instance data structures.
42  */
43 typedef struct module_instance_t {
44         char                    name[MAX_STRING_LEN];
45         module_entry_t          *entry;
46         void                    *insthandle;
47 #ifdef HAVE_PTHREAD_H
48         pthread_mutex_t         *mutex;
49 #endif
50         CONF_SECTION            *cs;
51         int                     dead;
52         fr_module_hup_t         *mh;
53 } module_instance_t;
54
55 module_instance_t *find_module_instance(CONF_SECTION *, const char *instname,
56                                         int do_link);
57 int module_hup_module(CONF_SECTION *cs, module_instance_t *node, time_t when);
58 #endif  /* FR_MODPRIV_H */