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[] = EAP_HANDLERS, keyed by the first octet of the State
44 * attribute, and composed of a linked list, ordered from
46 * types = All supported EAP-Types
47 * mutex = ensure only one thread is updating the sessions[] struct
49 typedef struct rlm_eap_t {
50 EAP_HANDLER *sessions[256];
51 EAP_TYPES *types[PW_EAP_MAX_TYPES + 1];
54 * Configuration items.
56 char *default_eap_type_name;
59 int ignore_unknown_eap_types;
60 int cisco_accounting_username_bug;
63 pthread_mutex_t session_mutex;
64 pthread_mutex_t module_mutex;
68 /* function definitions */
70 int eaptype_load(EAP_TYPES **type, int eap_type, CONF_SECTION *cs);
71 int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *h);
72 void eaptype_free(EAP_TYPES *tl);
75 int eap_start(rlm_eap_t *inst, REQUEST *request);
76 void eap_fail(EAP_HANDLER *handler);
77 void eap_success(EAP_HANDLER *handler);
78 int eap_compose(EAP_HANDLER *handler);
79 EAP_HANDLER *eap_handler(rlm_eap_t *inst, eap_packet_t **eap_msg, REQUEST *request);
81 /* Memory Management */
82 EAP_PACKET *eap_packet_alloc(void);
83 EAP_DS *eap_ds_alloc(void);
84 EAP_HANDLER *eap_handler_alloc(void);
85 void eap_packet_free(EAP_PACKET **eap_packet);
86 void eap_ds_free(EAP_DS **eap_ds);
87 void eap_handler_free(EAP_HANDLER **handler);
89 int eaplist_add(rlm_eap_t *inst, EAP_HANDLER *handler);
90 void eaplist_free(rlm_eap_t *inst);
91 EAP_HANDLER *eaplist_find(rlm_eap_t *inst, REQUEST *request,
92 eap_packet_t *eap_packet);
95 void generate_key(void);
96 VALUE_PAIR *generate_state(time_t timestamp);
97 int verify_state(VALUE_PAIR *state, time_t timestamp);