Add "extern C {...} to header files for C++ builds.
[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 #include "ltdl.h"
20 #endif
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 #ifdef WITHOUT_LIBLTDL
27 typedef void *lt_dlhandle;
28
29 lt_dlhandle lt_dlopenext(const char *name);
30 void *lt_dlsym(lt_dlhandle handle, const char *symbol);
31 int lt_dlclose(lt_dlhandle handle);
32 const char *lt_dlerror(void);
33
34 #define LTDL_SET_PRELOADED_SYMBOLS(_x)
35 #define lt_dlinit(_x) (0)
36 #define lt_dlexit(_x)
37 #define lt_dlsetsearchpath(_x)
38 #endif
39
40 /*
41  *      Keep track of which modules we've loaded.
42  */
43 typedef struct module_entry_t {
44         char                    name[MAX_STRING_LEN];
45         const module_t          *module;
46         lt_dlhandle             handle;
47 } module_entry_t;
48
49 typedef struct fr_module_hup_t fr_module_hup_t;
50
51 /*
52  *      Per-instance data structure, to correlate the modules
53  *      with the instance names (may NOT be the module names!),
54  *      and the per-instance data structures.
55  */
56 typedef struct module_instance_t {
57         char                    name[MAX_STRING_LEN];
58         module_entry_t          *entry;
59         void                    *insthandle;
60 #ifdef HAVE_PTHREAD_H
61         pthread_mutex_t         *mutex;
62 #endif
63         CONF_SECTION            *cs;
64         int                     dead;
65         fr_module_hup_t         *mh;
66 } module_instance_t;
67
68 module_instance_t *find_module_instance(CONF_SECTION *, const char *instname,
69                                         int do_link);
70 int module_hup_module(CONF_SECTION *cs, module_instance_t *node, time_t when);
71
72 #ifdef __cplusplus
73 }
74 #endif
75
76 #endif  /* FR_MODPRIV_H */