2 * rlm_eap.h Local Header file.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 * Copyright 2001 hereUare Communications, Inc. <raghud@hereuare.com>
21 * Copyright 2003 Alan DeKok <aland@freeradius.org>
22 * Copyright 2006 The FreeRADIUS server project
27 #include <freeradius-devel/ident.h>
28 RCSIDH(rlm_eap_h, "$Id$")
30 #include <freeradius-devel/modpriv.h>
32 #include "eap_types.h"
35 * Keep track of which sub modules we've loaded.
37 typedef struct eap_types_t {
46 * This structure contains eap's persistent data.
47 * sessions = remembered sessions, in a tree for speed.
48 * types = All supported EAP-Types
49 * mutex = ensure only one thread is updating the sessions[] struct
51 typedef struct rlm_eap_t {
52 rbtree_t *session_tree;
53 EAP_HANDLER *session_head, *session_tail;
54 rbtree_t *handler_tree; /* for debugging only */
55 EAP_TYPES *types[PW_EAP_MAX_TYPES + 1];
58 * Configuration items.
61 char *default_eap_type_name;
63 int ignore_unknown_eap_types;
64 int cisco_accounting_username_bug;
68 pthread_mutex_t session_mutex;
69 pthread_mutex_t handler_mutex;
72 const char *xlat_name; /* no xlat's yet */
77 * For simplicity in the rest of the code.
79 #ifndef HAVE_PTHREAD_H
81 * This is easier than ifdef's throughout the code.
83 #define pthread_mutex_init(_x, _y)
84 #define pthread_mutex_destroy(_x)
85 #define pthread_mutex_lock(_x)
86 #define pthread_mutex_unlock(_x)
89 /* function definitions */
91 int eaptype_load(EAP_TYPES **type, int eap_type, CONF_SECTION *cs);
92 int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *h);
93 void eaptype_free(EAP_TYPES *tl);
96 int eap_start(rlm_eap_t *inst, REQUEST *request);
97 void eap_fail(EAP_HANDLER *handler);
98 void eap_success(EAP_HANDLER *handler);
99 int eap_compose(EAP_HANDLER *handler);
100 EAP_HANDLER *eap_handler(rlm_eap_t *inst, eap_packet_t **eap_msg, REQUEST *request);
102 /* Memory Management */
103 EAP_PACKET *eap_packet_alloc(void);
104 EAP_DS *eap_ds_alloc(void);
105 EAP_HANDLER *eap_handler_alloc(rlm_eap_t *inst);
106 void eap_packet_free(EAP_PACKET **eap_packet);
107 void eap_ds_free(EAP_DS **eap_ds);
108 void eap_handler_free(rlm_eap_t *inst, EAP_HANDLER *handler);
110 int eaplist_add(rlm_eap_t *inst, EAP_HANDLER *handler);
111 EAP_HANDLER *eaplist_find(rlm_eap_t *inst, REQUEST *request,
112 eap_packet_t *eap_packet);
113 void eaplist_free(rlm_eap_t *inst);
116 void generate_key(void);
117 VALUE_PAIR *generate_state(time_t timestamp);
118 int verify_state(VALUE_PAIR *state, time_t timestamp);
120 #endif /*_RLM_EAP_H*/