2 * eap.h Header file containing the interfaces for all EAP types.
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>
30 #include <freeradius-devel/radiusd.h>
31 #include <freeradius-devel/modules.h>
32 #include <freeradius-devel/rad_assert.h>
34 #include "eap_types.h"
37 * EAP_DS contains all the received/sending information
38 * response = Received EAP packet
39 * request = Sending EAP packet
41 * Note: We are authentication server,
42 * we get ONLY EAP-Responses and
43 * we send EAP-Request/EAP-success/EAP-failure
45 typedef struct eap_ds {
52 * Currently there are only 2 types
53 * of operations defined,
54 * apart from attach & detach for each EAP-Type.
56 typedef enum operation_t {
64 * EAP_HANDLER is the interface for any EAP-Type.
65 * Each handler contains information for one specific EAP-Type.
66 * This way we don't need to change any interfaces in future.
67 * It is also a list of EAP-request handlers waiting for EAP-response
68 * eap_id = copy of the eap packet we sent to the
70 * next = pointer to next
71 * state = state attribute from the reply we sent
72 * state_len = length of data in the state attribute.
73 * src_ipaddr = client which sent us the RADIUS request containing
74 * this EAP conversation.
75 * eap_id = copy of EAP id we sent to the client.
76 * timestamp = timestamp when this handler was last used.
77 * identity = Identity, as obtained, from EAP-Identity response.
78 * request = RADIUS request data structure
79 * prev_eapds = Previous EAP request, for which eap_ds contains the response.
80 * eap_ds = Current EAP response.
81 * opaque = EAP-Type holds some data that corresponds to the current
82 * EAP-request/response
83 * free_opaque = To release memory held by opaque,
84 * when this handler is timedout & needs to be deleted.
85 * It is the responsibility of the specific EAP-TYPE
86 * to avoid any memory leaks in opaque
87 * Hence this pointer should be provided by the EAP-Type
88 * if opaque is not NULL
89 * status = finished/onhold/..
91 #define EAP_STATE_LEN (AUTH_VECTOR_LEN)
92 typedef struct _eap_handler {
93 struct _eap_handler *prev, *next;
94 uint8_t state[EAP_STATE_LEN];
95 lrad_ipaddr_t src_ipaddr;
97 unsigned int eap_type;
103 char *identity; /* User name from EAP-Identity */
109 void (*free_opaque)(void *opaque);
117 * Interface to call EAP sub mdoules
119 typedef struct eap_type_t {
121 int (*attach)(CONF_SECTION *conf, void **type_data);
122 int (*initiate)(void *type_data, EAP_HANDLER *handler);
123 int (*authorize)(void *type_data, EAP_HANDLER *handler);
124 int (*authenticate)(void *type_data, EAP_HANDLER *handler);
125 int (*detach)(void *type_data);
128 #define REQUEST_DATA_EAP_HANDLER (1)
129 #define REQUEST_DATA_EAP_TUNNEL_CALLBACK PW_EAP_MESSAGE
130 #define REQUEST_DATA_EAP_MSCHAP_TUNNEL_CALLBACK ((PW_EAP_MESSAGE << 16) | PW_EAP_MSCHAPV2)
131 #define RAD_REQUEST_OPTION_PROXY_EAP (1 << 16)
134 * This is for tunneled callbacks
136 typedef int (*eap_tunnel_callback_t)(EAP_HANDLER *handler, void *tls_session);
137 typedef struct eap_tunnel_data_t {
139 eap_tunnel_callback_t callback;