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>
28 #include <sys/types.h>
32 #include <netinet/in.h>
41 #include "rad_assert.h"
43 #define PW_EAP_REQUEST 1
44 #define PW_EAP_RESPONSE 2
45 #define PW_EAP_SUCCESS 3
46 #define PW_EAP_FAILURE 4
47 #define PW_EAP_MAX_CODES 4
49 #define PW_EAP_IDENTITY 1
50 #define PW_EAP_NOTIFICATION 2
56 #define PW_EAP_LEAP 17
57 #define PW_EAP_MAX_TYPES 17
59 #define EAP_HEADER_LEN 4
62 * EAP-Type specific data.
64 typedef struct eaptype_t {
71 * Structure to hold EAP data.
73 * length = code + id + length + type + type.data
76 typedef struct eap_packet {
82 unsigned char *packet;
86 * EAP_DS contains all the received/sending information
87 * response = Received EAP packet
88 * request = Sending EAP packet
90 * Note: We are authentication server,
91 * we get ONLY EAP-Responses and
92 * we send EAP-Request/EAP-success/EAP-failure
94 typedef struct eap_ds {
101 * Currently there are only 2 types
102 * of operations defined,
103 * apart from attach & detach for each EAP-Type.
105 typedef enum operation_t {
113 * EAP_HANDLER is the interface for any EAP-Type.
114 * Each handler contains information for one specific EAP-Type.
115 * This way we don't need to change any interfaces in future.
116 * It is also a list of EAP-request handlers waiting for EAP-response
117 * eap_id = copy of the eap packet we sent to the
119 * next = pointer to next
120 * state = state attribute from the reply we sent
121 * state_len = length of data in the state attribute.
122 * src_ipaddr = client which sent us the RADIUS request containing
123 * this EAP conversation.
124 * eap_id = copy of EAP id we sent to the client.
125 * timestamp = timestamp when this handler was last used.
126 * identity = Identity, as obtained, from EAP-Identity response.
127 * username = as obtained in Radius request, It might differ from identity.
128 * request = RADIUS request data structure
129 * prev_eapds = Previous EAP request, for which eap_ds contains the response.
130 * eap_ds = Current EAP response.
131 * opaque = EAP-Type holds some data that corresponds to the current
132 * EAP-request/response
133 * free_opaque = To release memory held by opaque,
134 * when this handler is timedout & needs to be deleted.
135 * It is the responsibility of the specific EAP-TYPE
136 * to avoid any memory leaks in opaque
137 * Hence this pointer should be provided by the EAP-Type
138 * if opaque is not NULL
139 * status = finished/onhold/..
141 #define EAP_STATE_LEN (AUTH_VECTOR_LEN)
142 typedef struct _eap_handler {
143 struct _eap_handler *next;
145 uint8_t state[EAP_STATE_LEN];
151 VALUE_PAIR *username; /* SHOULD get rid of this! */
154 char *identity; /* user identity? Huh? */
160 void (*free_opaque)(void *opaque);
168 * Interface to call EAP sub mdoules
170 typedef struct eap_type_t {
172 int (*attach)(CONF_SECTION *conf, void **type_data);
173 int (*initiate)(void *type_data, EAP_HANDLER *handler);
174 int (*authorize)(void *type_data, EAP_HANDLER *handler);
175 int (*authenticate)(void *type_data, EAP_HANDLER *handler);
176 int (*detach)(void *type_data);