2 * module.h Interface to the RADIUS module system.
8 #ifndef RADIUS_MODULES_H
9 #define RADIUS_MODULES_H
12 typedef int (*packetmethod)(void *instance, REQUEST *request);
14 #define RLM_COMPONENT_AUTH 0
15 #define RLM_COMPONENT_AUTZ 1
16 #define RLM_COMPONENT_PREACCT 2
17 #define RLM_COMPONENT_ACCT 3
18 #define RLM_COMPONENT_SESS 4
19 #define RLM_COMPONENT_COUNT 5 /* How many components are there */
21 #define RLM_TYPE_THREAD_SAFE (0 << 0)
22 #define RLM_TYPE_THREAD_UNSAFE (1 << 0)
24 typedef struct module_t {
26 int type; /* reserved */
28 int (*instantiate)(CONF_SECTION *mod_cs, void **instance);
29 packetmethod methods[RLM_COMPONENT_COUNT];
30 int (*detach)(void *instance);
34 extern const char *component_names[RLM_COMPONENT_COUNT];
37 RLM_MODULE_REJECT, /* immediately reject the request */
38 RLM_MODULE_FAIL, /* module failed, don't reply */
39 RLM_MODULE_OK, /* the module is OK, continue */
40 RLM_MODULE_HANDLED, /* the module handled the request, so stop. */
41 RLM_MODULE_INVALID, /* the module considers the request invalid. */
42 RLM_MODULE_USERLOCK, /* reject the request (user is locked out) */
43 RLM_MODULE_NOTFOUND, /* user not found */
44 RLM_MODULE_NOOP, /* module succeeded without doing anything */
45 RLM_MODULE_UPDATED, /* OK (pairs modified) */
46 RLM_MODULE_NUMCODES /* How many return codes there are */
49 int setup_modules(void);
50 int module_authorize(REQUEST *request);
51 int module_authenticate(int type, REQUEST *request);
52 int module_preacct(REQUEST *request);
53 int module_accounting(REQUEST *request);
54 int module_checksimul(REQUEST *request, int maxsimul);
56 #endif /* RADIUS_MODULES_H */