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