added EAP PEAP and MSTLV protocols
[strongswan.git] / src / libstrongswan / eap / eap.h
1 /*
2 * Copyright (C) 2010 Martin Willi
3 * Copyright (C) 2010 revosec AG
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup eap eap
18 * @{ @ingroup libstrongswan
19 */
20
21 #ifndef EAP_H_
22 #define EAP_H_
23
24 typedef enum eap_code_t eap_code_t;
25 typedef enum eap_type_t eap_type_t;
26
27 #include <library.h>
28
29 /**
30 * EAP code, type of an EAP message
31 */
32 enum eap_code_t {
33 EAP_REQUEST = 1,
34 EAP_RESPONSE = 2,
35 EAP_SUCCESS = 3,
36 EAP_FAILURE = 4,
37 };
38
39 /**
40 * enum names for eap_code_t.
41 */
42 extern enum_name_t *eap_code_names;
43
44 /**
45 * short string enum names for eap_code_t.
46 */
47 extern enum_name_t *eap_code_short_names;
48
49 /**
50 * EAP types, defines the EAP method implementation
51 */
52 enum eap_type_t {
53 EAP_IDENTITY = 1,
54 EAP_NOTIFICATION = 2,
55 EAP_NAK = 3,
56 EAP_MD5 = 4,
57 EAP_OTP = 5,
58 EAP_GTC = 6,
59 EAP_TLS = 13,
60 EAP_SIM = 18,
61 EAP_TTLS = 21,
62 EAP_AKA = 23,
63 EAP_PEAP = 25,
64 EAP_MSCHAPV2 = 26,
65 EAP_MSTLV = 33,
66 EAP_TNC = 38,
67 /** select EAP method dynamically based on i.e. EAP-Identity */
68 EAP_DYNAMIC = 252,
69 /** not a method, but an implementation providing different methods */
70 EAP_RADIUS = 253,
71 EAP_EXPANDED = 254,
72 EAP_EXPERIMENTAL = 255,
73 };
74
75 /**
76 * enum names for eap_type_t.
77 */
78 extern enum_name_t *eap_type_names;
79
80 /**
81 * short string enum names for eap_type_t.
82 */
83 extern enum_name_t *eap_type_short_names;
84
85 /**
86 * EAP packet format
87 */
88 typedef struct __attribute__((packed)) {
89 u_int8_t code;
90 u_int8_t identifier;
91 u_int16_t length;
92 u_int8_t type;
93 u_int8_t data;
94 } eap_packet_t;
95
96 /**
97 * Lookup the EAP method type from a string.
98 *
99 * @param name EAP method name (such as "md5", "aka")
100 * @return method type, 0 if unknown
101 */
102 eap_type_t eap_type_from_string(char *name);
103
104 #endif /** EAP_H_ @}*/