All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
eap_types.h
Go to the documentation of this file.
1 /*
2  * eap_types.h Header file containing the interfaces for all EAP types.
3  *
4  * most contents moved from modules/rlm_eap/eap.h
5  *
6  * Version: $Id: f828ec8e8c9398a9f34275e8bc7dee2b33d4d674 $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  *
22  * Copyright 2001 hereUare Communications, Inc. <raghud@hereuare.com>
23  * Copyright 2003 Alan DeKok <aland@freeradius.org>
24  * Copyright 2006 The FreeRADIUS server project
25  */
26 #ifndef _EAP_TYPES_H
27 #define _EAP_TYPES_H
28 
29 RCSIDH(eap_methods_h, "$Id: f828ec8e8c9398a9f34275e8bc7dee2b33d4d674 $")
30 
31 #include <freeradius-devel/radiusd.h>
32 #include <freeradius-devel/modules.h>
33 
34 /* Code (1) + Identifier (1) + Length (2) */
35 #define EAP_HEADER_LEN 4
36 
37 typedef enum eap_code {
43 } eap_code_t;
44 
45 typedef enum eap_method {
46  PW_EAP_INVALID = 0, /* 0 */
47  PW_EAP_IDENTITY, /* 1 */
49  PW_EAP_NAK, /* 3 */
50  PW_EAP_MD5, /* 4 */
51  PW_EAP_OTP, /* 5 */
52  PW_EAP_GTC, /* 6 */
53  PW_EAP_7, /* 7 - unused */
54  PW_EAP_8, /* 8 - unused */
57  PW_EAP_KEA, /* 11 */
59  PW_EAP_TLS, /* 13 */
63  PW_EAP_LEAP, /* 17 */
64  PW_EAP_SIM, /* 18 */
65  PW_EAP_SRP_SHA1, /* 19 */
66  PW_EAP_20, /* 20 - unassigned */
67  PW_EAP_TTLS, /* 21 */
69  PW_EAP_AKA, /* 23 */
70  PW_EAP_3COM, /* 24 - should this be EAP-HP now? */
71  PW_EAP_PEAP, /* 25 */
72  PW_EAP_MSCHAPV2, /* 26 */
73  PW_EAP_MAKE, /* 27 */
76  PW_EAP_DYNAMID, /* 30 */
77  PW_EAP_ROB, /* 31 */
78  PW_EAP_POTP, /* 32 */
79  PW_EAP_MS_ATLV, /* 33 */
80  PW_EAP_SENTRINET, /* 34 */
81  PW_EAP_ACTIONTEC, /* 35 */
84  PW_EAP_TNC, /* 38 - fixme conflicts with HTTP DIGEST */
85 // PW_EAP_HTTP_DIGEST, /* 38 */
88  PW_EAP_SPEKE, /* 41 */
89  PW_EAP_MOBAC, /* 42 */
90  PW_EAP_FAST, /* 43 */
91  PW_EAP_ZONELABS, /* 44 */
92  PW_EAP_LINK, /* 45 */
93  PW_EAP_PAX, /* 46 */
94  PW_EAP_PSK, /* 47 */
95  PW_EAP_SAKE, /* 48 */
96  PW_EAP_IKEV2, /* 49 */
97  PW_EAP_AKA2, /* 50 */
98  PW_EAP_GPSK, /* 51 */
99  PW_EAP_PWD, /* 52 */
100  PW_EAP_EKE, /* 53 */
101  PW_EAP_MAX_TYPES /* 54 - for validation */
102 } eap_type_t;
103 
104 #define PW_EAP_EXPANDED_TYPE (254)
105 
106 typedef enum eap_rcode {
107  EAP_NOTFOUND, //!< EAP eap_session data not found.
108  EAP_FOUND, //!< EAP eap_session data found, continue.
109  EAP_OK, //!< Ok, continue.
110  EAP_FAIL, //!< Failed, don't reply.
111  EAP_NOOP, //!< Succeeded without doing anything.
112  EAP_INVALID, //!< Invalid, don't reply.
113  EAP_VALID, //!< Valid, continue.
115 } eap_rcode_t;
116 
117 extern const FR_NAME_NUMBER eap_rcode_table[];
118 
119 /** EAP-Type specific data
120  */
121 typedef struct eap_type_data {
123  size_t length;
124  uint8_t *data;
126 
127 /** Structure to hold EAP data
128  *
129  * length = code + id + length + type + type.data
130  * = 1 + 1 + 2 + 1 + X
131  */
132 typedef struct eap_packet {
134  uint8_t id;
135  size_t length;
137 
138  uint8_t *packet;
139 } eap_packet_t;
140 
141 /** Structure to represent packet format of eap *on wire*
142  */
143 typedef struct eap_packet_raw {
144  uint8_t code;
145  uint8_t id;
146  uint8_t length[2];
147  uint8_t data[1];
149 
150 
151 /*
152  * interfaces in eapcommon.c
153  */
154 eap_type_t eap_name2type(char const *name);
155 char const *eap_type2name(eap_type_t method);
156 int eap_wireformat(eap_packet_t *reply);
157 int eap_basic_compose(RADIUS_PACKET *packet, eap_packet_t *reply);
159 eap_packet_raw_t *eap_vp2packet(TALLOC_CTX *ctx, VALUE_PAIR *vps);
160 void eap_add_reply(REQUEST *request, char const *name, uint8_t const *value, int len);
161 
162 #endif /* _EAP_TYPES_H */
uint8_t id
Definition: eap_types.h:145
uint8_t * packet
Definition: eap_types.h:138
size_t length
Definition: eap_types.h:135
#define RCSIDH(h, id)
Definition: build.h:136
Ok, continue.
Definition: eap_types.h:109
Invalid, don't reply.
Definition: eap_types.h:112
struct eap_type_data eap_type_data_t
EAP-Type specific data.
eap_type_t eap_name2type(char const *name)
Return an EAP-Type for a particular name.
Definition: eapcommon.c:88
static char const * name
uint8_t code
Definition: eap_types.h:144
eap_packet_raw_t * eap_vp2packet(TALLOC_CTX *ctx, VALUE_PAIR *vps)
Definition: eapcommon.c:297
eap_type_data_t type
Definition: eap_types.h:136
EAP-Type specific data.
Definition: eap_types.h:121
VALUE_PAIR * eap_packet2vp(RADIUS_PACKET *packet, eap_packet_raw_t const *reply)
Definition: eapcommon.c:251
enum eap_method eap_type_t
eap_type_t num
Definition: eap_types.h:122
enum eap_rcode eap_rcode_t
struct eap_packet eap_packet_t
Structure to hold EAP data.
eap_rcode
Definition: eap_types.h:106
uint8_t id
Definition: eap_types.h:134
eap_method
Definition: eap_types.h:45
Structure to represent packet format of eap on wire
Definition: eap_types.h:143
Failed, don't reply.
Definition: eap_types.h:110
Stores an attribute, a value and various bits of other data.
Definition: pair.h:112
size_t length
Definition: eap_types.h:123
const FR_NAME_NUMBER eap_rcode_table[]
Definition: eapcommon.c:67
uint8_t length[2]
Definition: eap_types.h:146
uint8_t data[1]
Definition: eap_types.h:147
Valid, continue.
Definition: eap_types.h:113
eap_code
Definition: eap_types.h:37
EAP eap_session data found, continue.
Definition: eap_types.h:108
char const * eap_type2name(eap_type_t method)
Return an EAP-name for a particular type.
Definition: eapcommon.c:104
int eap_basic_compose(RADIUS_PACKET *packet, eap_packet_t *reply)
Definition: eapcommon.c:191
int eap_wireformat(eap_packet_t *reply)
Definition: eapcommon.c:128
EAP eap_session data not found.
Definition: eap_types.h:107
enum eap_code eap_code_t
Succeeded without doing anything.
Definition: eap_types.h:111
Structure to hold EAP data.
Definition: eap_types.h:132
struct eap_packet_raw eap_packet_raw_t
Structure to represent packet format of eap on wire
eap_code_t code
Definition: eap_types.h:133
void eap_add_reply(REQUEST *request, char const *name, uint8_t const *value, int len)
Definition: eapcommon.c:388
uint8_t * data
Definition: eap_types.h:124