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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * Copyright 2001 hereUare Communications, Inc. <raghud@hereuare.com>
21 * Copyright 2003 Alan DeKok <aland@freeradius.org>
28 #include "eap_types.h"
31 * Keep track of which sub modules we've loaded.
33 typedef struct eap_types_t {
42 * This structure contains eap's persistent data.
43 * sessions = remembered sessions, in a tree for speed.
44 * types = All supported EAP-Types
45 * mutex = ensure only one thread is updating the sessions[] struct
47 typedef struct rlm_eap_t {
48 rbtree_t *session_tree;
49 EAP_HANDLER *session_head, *session_tail;
50 EAP_TYPES *types[PW_EAP_MAX_TYPES + 1];
53 * Configuration items.
56 char *default_eap_type_name;
58 int ignore_unknown_eap_types;
59 int cisco_accounting_username_bug;
62 pthread_mutex_t session_mutex;
67 * For simplicity in the rest of the code.
69 #ifndef HAVE_PTHREAD_H
71 * This is easier than ifdef's throughout the code.
73 #define pthread_mutex_init(_x, _y)
74 #define pthread_mutex_destroy(_x)
75 #define pthread_mutex_lock(_x)
76 #define pthread_mutex_unlock(_x)
79 /* function definitions */
81 int eaptype_load(EAP_TYPES **type, int eap_type, CONF_SECTION *cs);
82 int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *h);
83 void eaptype_free(EAP_TYPES *tl);
86 int eap_start(rlm_eap_t *inst, REQUEST *request);
87 void eap_fail(EAP_HANDLER *handler);
88 void eap_success(EAP_HANDLER *handler);
89 int eap_compose(EAP_HANDLER *handler);
90 EAP_HANDLER *eap_handler(rlm_eap_t *inst, eap_packet_t **eap_msg, REQUEST *request);
92 /* Memory Management */
93 EAP_PACKET *eap_packet_alloc(void);
94 EAP_DS *eap_ds_alloc(void);
95 EAP_HANDLER *eap_handler_alloc(void);
96 void eap_packet_free(EAP_PACKET **eap_packet);
97 void eap_ds_free(EAP_DS **eap_ds);
98 void eap_handler_free(EAP_HANDLER *handler);
100 int eaplist_add(rlm_eap_t *inst, EAP_HANDLER *handler);
101 EAP_HANDLER *eaplist_find(rlm_eap_t *inst, REQUEST *request,
102 eap_packet_t *eap_packet);
103 void eaplist_free(rlm_eap_t *inst);
106 void generate_key(void);
107 VALUE_PAIR *generate_state(time_t timestamp);
108 int verify_state(VALUE_PAIR *state, time_t timestamp);
110 #endif /*_RLM_EAP_H*/