]> git.stg.codes - stg.git/blob - projects/rlm_stg/modules.h
Добавление исходников
[stg.git] / projects / rlm_stg / modules.h
1 /*
2  * module.h     Interface to the RADIUS module system.
3  *
4  * Version:     $Id: modules.h,v 1.1 2010/08/14 04:13:52 faust Exp $
5  *
6  */
7
8 #ifndef RADIUS_MODULES_H
9 #define RADIUS_MODULES_H
10
11 #include <freeradius/ident.h>
12 RCSIDH(modules_h, "$Id: modules.h,v 1.1 2010/08/14 04:13:52 faust Exp $")
13
14 #include "conffile.h"
15
16 typedef int (*packetmethod)(void *instance, REQUEST *request);
17
18 enum {
19   RLM_COMPONENT_AUTH = 0,
20   RLM_COMPONENT_AUTZ,           /* 1 */
21   RLM_COMPONENT_PREACCT,        /* 2 */
22   RLM_COMPONENT_ACCT,           /* 3 */
23   RLM_COMPONENT_SESS,           /* 4 */
24   RLM_COMPONENT_PRE_PROXY,      /* 5 */
25   RLM_COMPONENT_POST_PROXY,     /* 6 */
26   RLM_COMPONENT_POST_AUTH,      /* 7 */
27 #ifdef WITH_COA
28   RLM_COMPONENT_RECV_COA,       /* 8 */
29   RLM_COMPONENT_SEND_COA,       /* 9 */
30 #endif
31   RLM_COMPONENT_COUNT           /* 8 / 10: How many components are there */
32 };
33
34 #define RLM_TYPE_THREAD_SAFE            (0 << 0)
35 #define RLM_TYPE_THREAD_UNSAFE          (1 << 0)
36 #define RLM_TYPE_CHECK_CONFIG_SAFE      (1 << 1)
37 #define RLM_TYPE_HUP_SAFE               (1 << 2)
38
39 #define RLM_MODULE_MAGIC_NUMBER ((uint32_t) (0xf4ee4ad2))
40 #define RLM_MODULE_INIT RLM_MODULE_MAGIC_NUMBER
41
42 typedef struct module_t {
43         uint32_t        magic;  /* may later be opaque struct */
44         const char      *name;
45         int             type;
46         int             (*instantiate)(CONF_SECTION *mod_cs, void **instance);
47         int             (*detach)(void *instance);
48         packetmethod    methods[RLM_COMPONENT_COUNT];
49 } module_t;
50
51 enum {
52         RLM_MODULE_REJECT,      /* immediately reject the request */
53         RLM_MODULE_FAIL,        /* module failed, don't reply */
54         RLM_MODULE_OK,          /* the module is OK, continue */
55         RLM_MODULE_HANDLED,     /* the module handled the request, so stop. */
56         RLM_MODULE_INVALID,     /* the module considers the request invalid. */
57         RLM_MODULE_USERLOCK,    /* reject the request (user is locked out) */
58         RLM_MODULE_NOTFOUND,    /* user not found */
59         RLM_MODULE_NOOP,        /* module succeeded without doing anything */
60         RLM_MODULE_UPDATED,     /* OK (pairs modified) */
61         RLM_MODULE_NUMCODES     /* How many return codes there are */
62 };
63
64 int setup_modules(int, CONF_SECTION *);
65 int detach_modules(void);
66 int module_hup(CONF_SECTION *modules);
67 int module_authorize(int type, REQUEST *request);
68 int module_authenticate(int type, REQUEST *request);
69 int module_preacct(REQUEST *request);
70 int module_accounting(int type, REQUEST *request);
71 int module_checksimul(int type, REQUEST *request, int maxsimul);
72 int module_pre_proxy(int type, REQUEST *request);
73 int module_post_proxy(int type, REQUEST *request);
74 int module_post_auth(int type, REQUEST *request);
75 #ifdef WITH_COA
76 int module_recv_coa(int type, REQUEST *request);
77 int module_send_coa(int type, REQUEST *request);
78 #define MODULE_NULL_COA_FUNCS ,NULL,NULL
79 #else
80 #define MODULE_NULL_COA_FUNCS
81 #endif
82 int indexed_modcall(int comp, int idx, REQUEST *request);
83
84 /*
85  *      For now, these are strongly tied together.
86  */
87 int virtual_servers_load(CONF_SECTION *config);
88 void virtual_servers_free(time_t when);
89
90
91 #endif /* RADIUS_MODULES_H */