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/autoconf.h>
32 #ifdef HAVE_SYS_TYPES_H
33 #include <sys/types.h>
36 #ifdef HAVE_NETINET_IN_H
37 #include <netinet/in.h>
43 #include <freeradius-devel/radiusd.h>
44 #include <freeradius-devel/modules.h>
46 #include <freeradius-devel/rad_assert.h>
48 #include "eap_types.h"
51 * EAP_DS contains all the received/sending information
52 * response = Received EAP packet
53 * request = Sending EAP packet
55 * Note: We are authentication server,
56 * we get ONLY EAP-Responses and
57 * we send EAP-Request/EAP-success/EAP-failure
59 typedef struct eap_ds {
66 * Currently there are only 2 types
67 * of operations defined,
68 * apart from attach & detach for each EAP-Type.
70 typedef enum operation_t {
78 * EAP_HANDLER is the interface for any EAP-Type.
79 * Each handler contains information for one specific EAP-Type.
80 * This way we don't need to change any interfaces in future.
81 * It is also a list of EAP-request handlers waiting for EAP-response
82 * eap_id = copy of the eap packet we sent to the
84 * next = pointer to next
85 * state = state attribute from the reply we sent
86 * state_len = length of data in the state attribute.
87 * src_ipaddr = client which sent us the RADIUS request containing
88 * this EAP conversation.
89 * eap_id = copy of EAP id we sent to the client.
90 * timestamp = timestamp when this handler was last used.
91 * identity = Identity, as obtained, from EAP-Identity response.
92 * request = RADIUS request data structure
93 * prev_eapds = Previous EAP request, for which eap_ds contains the response.
94 * eap_ds = Current EAP response.
95 * opaque = EAP-Type holds some data that corresponds to the current
96 * EAP-request/response
97 * free_opaque = To release memory held by opaque,
98 * when this handler is timedout & needs to be deleted.
99 * It is the responsibility of the specific EAP-TYPE
100 * to avoid any memory leaks in opaque
101 * Hence this pointer should be provided by the EAP-Type
102 * if opaque is not NULL
103 * status = finished/onhold/..
105 #define EAP_STATE_LEN (AUTH_VECTOR_LEN)
106 typedef struct _eap_handler {
107 struct _eap_handler *prev, *next;
108 uint8_t state[EAP_STATE_LEN];
109 lrad_ipaddr_t src_ipaddr;
111 unsigned int eap_type;
117 char *identity; /* User name from EAP-Identity */
123 void (*free_opaque)(void *opaque);
131 * Interface to call EAP sub mdoules
133 typedef struct eap_type_t {
135 int (*attach)(CONF_SECTION *conf, void **type_data);
136 int (*initiate)(void *type_data, EAP_HANDLER *handler);
137 int (*authorize)(void *type_data, EAP_HANDLER *handler);
138 int (*authenticate)(void *type_data, EAP_HANDLER *handler);
139 int (*detach)(void *type_data);
142 #define REQUEST_DATA_EAP_HANDLER (1)
143 #define REQUEST_DATA_EAP_TUNNEL_CALLBACK PW_EAP_MESSAGE
144 #define REQUEST_DATA_EAP_MSCHAP_TUNNEL_CALLBACK ((PW_EAP_MESSAGE << 16) | PW_EAP_MSCHAPV2)
145 #define RAD_REQUEST_OPTION_PROXY_EAP (1 << 16)
148 * This is for tunneled callbacks
150 typedef int (*eap_tunnel_callback_t)(EAP_HANDLER *handler, void *tls_session);
151 typedef struct eap_tunnel_data_t {
153 eap_tunnel_callback_t callback;