Initial revision
[freeradius.git] / src / include / modules.h
1 /*
2  * module.h     Interface to the RADIUS module system.
3  *
4  * Version:     @(#)module.h  0.02  11-Aug-1999  miquels@cistron.nl
5  *
6  */
7
8 typedef struct module_t {
9         char    *name;
10         int     type;                   /* reserved */
11         int     (*init)(int argc, char **argv);
12         int     (*authorize)(REQUEST *request, char *username,
13                         VALUE_PAIR **check_items, VALUE_PAIR **reply_items);
14         int     (*authenticate)(REQUEST *request, char *username,
15                         char *password);
16         int     (*accounting)(REQUEST *request);
17         int     (*detach)(void);
18 } module_t;
19
20 enum {
21   RLM_AUTH_FAIL = -2,           /* Failed (don't reply) */
22   RLM_AUTH_REJECT = -1,         /* authentication failed - reject */
23   RLM_AUTH_OK = 0,              /* OK */
24   RLM_AUTH_HANDLED = 1,         /* OK, handled (don't reply) */
25 };
26 enum {
27   RLM_AUTZ_REJECT = -3,         /* Reject user */
28   RLM_AUTZ_FAIL = -2,           /* Failed (don't reply) */
29   RLM_AUTZ_NOTFOUND = -1,       /* User not found - try next autorization */
30   RLM_AUTZ_OK = 0,              /* OK */
31   RLM_AUTZ_HANDLED = 1,         /* OK, handled (don't reply) */
32 };
33 enum {
34   RLM_ACCT_FAIL = -2,           /* Failed (don't reply) */
35   RLM_ACCT_FAIL_SOFT = -1,      /* Failed, but who cares. Continue */
36   RLM_ACCT_OK = 0,              /* OK */
37   RLM_ACCT_HANDLED = 1,         /* OK, handled (don't reply) */
38 };
39 #define RLM_ACCT_FAIL_HARD RLM_ACCT_FAIL
40
41 int read_modules_file(char *filename);
42 int module_authorize(REQUEST *request, char *username,
43         VALUE_PAIR **check_items, VALUE_PAIR **reply_items);
44 int module_authenticate(int type, REQUEST *request,
45         char *username, char *password);
46 int module_accounting(REQUEST *request);
47