removed the check_items && reply_items from the authorize and
[freeradius.git] / src / include / modules.h
1 /*
2  * module.h     Interface to the RADIUS module system.
3  *
4  * Version:     $Id$
5  *
6  */
7
8 #include "conffile.h"
9
10 /*
11  *      The types of the functions which are supported by each module.
12  *      The functional parameters are defined here, so we don't have to
13  *      edit each and every module when we decide to add another type
14  *      of request handler.
15  */
16 typedef int (*RLM_AUTHORIZE_FUNCP)(REQUEST *request);
17 typedef int (*RLM_AUTHENTICATE_FUNCP)(REQUEST *request);
18 typedef int (*RLM_POST_AUTHENTICATE_FUNCP)(REQUEST *request);
19 typedef int (*RLM_PRE_ACCOUNTING_FUNCP)(REQUEST *request);
20 typedef int (*RLM_ACCOUNTING_FUNCP)(REQUEST *request);
21
22 /* Shouldn't need these anymore */
23 #define RLM_COMPONENT_AUTZ 0
24 #define RLM_COMPONENT_AUTH 1
25 #define RLM_COMPONENT_PREACCT 2
26 #define RLM_COMPONENT_ACCT 3
27 #define RLM_COMPONENT_COUNT 4 /* How many components are there */
28
29 typedef struct module_t {
30         const char      *name;
31         int     type;                   /* reserved */
32         int     (*init)(void);
33         int     (*instantiate)(CONF_SECTION *mod_cs, void **instance);
34         int     (*authorize)(void *instance, REQUEST *request);
35         int     (*authenticate)(void *instance, REQUEST *request);
36         int     (*preaccounting)(void *instance, REQUEST *request);
37         int     (*accounting)(void *instance, REQUEST *request);
38         int     (*detach)(void *instance);
39         int     (*destroy)(void);
40 } module_t;
41
42 enum {
43         RLM_MODULE_REJECT = -2, /* reject the request */
44         RLM_MODULE_FAIL = -1,   /* module failed, don't reply */
45         RLM_MODULE_OK = 0,      /* the module is OK, continue */
46         RLM_MODULE_HANDLED = 1  /* the module handled the request, so stop. */
47 };
48
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