]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/wpa_supplicant/eap_i.h
This commit was generated by cvs2svn to compensate for changes in r147899,
[FreeBSD/FreeBSD.git] / contrib / wpa_supplicant / eap_i.h
1 #ifndef EAP_I_H
2 #define EAP_I_H
3
4 #include "eap.h"
5
6 /* draft-ietf-eap-statemachine-05.pdf - Peer state machine */
7
8 typedef enum {
9         DECISION_FAIL, DECISION_COND_SUCC, DECISION_UNCOND_SUCC
10 } EapDecision;
11
12 typedef enum {
13         METHOD_NONE, METHOD_INIT, METHOD_CONT, METHOD_MAY_CONT, METHOD_DONE
14 } EapMethodState;
15
16 struct eap_method_ret {
17         Boolean ignore;
18         EapMethodState methodState;
19         EapDecision decision;
20         Boolean allowNotifications;
21 };
22
23
24 struct eap_method {
25         EapType method;
26         const char *name;
27
28         void * (*init)(struct eap_sm *sm);
29         void (*deinit)(struct eap_sm *sm, void *priv);
30         u8 * (*process)(struct eap_sm *sm, void *priv,
31                         struct eap_method_ret *ret,
32                         u8 *reqData, size_t reqDataLen,
33                         size_t *respDataLen);
34         Boolean (*isKeyAvailable)(struct eap_sm *sm, void *priv);
35         u8 * (*getKey)(struct eap_sm *sm, void *priv, size_t *len);
36         int (*get_status)(struct eap_sm *sm, void *priv, char *buf,
37                           size_t buflen, int verbose);
38
39         /* Optional handlers for fast re-authentication */
40         Boolean (*has_reauth_data)(struct eap_sm *sm, void *priv);
41         void (*deinit_for_reauth)(struct eap_sm *sm, void *priv);
42         void * (*init_for_reauth)(struct eap_sm *sm, void *priv);
43         const u8 * (*get_identity)(struct eap_sm *sm, void *priv, size_t *len);
44 };
45
46
47 struct eap_sm {
48         enum {
49                 EAP_INITIALIZE, EAP_DISABLED, EAP_IDLE, EAP_RECEIVED,
50                 EAP_GET_METHOD, EAP_METHOD, EAP_SEND_RESPONSE, EAP_DISCARD,
51                 EAP_IDENTITY, EAP_NOTIFICATION, EAP_RETRANSMIT, EAP_SUCCESS,
52                 EAP_FAILURE
53         } EAP_state;
54         /* Long-term local variables */
55         EapType selectedMethod;
56         EapMethodState methodState;
57         int lastId;
58         u8 *lastRespData;
59         size_t lastRespDataLen;
60         EapDecision decision;
61         /* Short-term local variables */
62         Boolean rxReq;
63         Boolean rxSuccess;
64         Boolean rxFailure;
65         int reqId;
66         EapType reqMethod;
67         Boolean ignore;
68         /* Constants */
69         int ClientTimeout;
70
71         /* Miscellaneous variables */
72         Boolean allowNotifications; /* peer state machine <-> methods */
73         u8 *eapRespData; /* peer to lower layer */
74         size_t eapRespDataLen; /* peer to lower layer */
75         Boolean eapKeyAvailable; /* peer to lower layer */
76         u8 *eapKeyData; /* peer to lower layer */
77         size_t eapKeyDataLen; /* peer to lower layer */
78         const struct eap_method *m; /* selected EAP method */
79         /* not defined in draft-ietf-eap-statemachine-02 */
80         Boolean changed;
81         void *eapol_ctx;
82         struct eapol_callbacks *eapol_cb;
83         void *eap_method_priv;
84         int init_phase2;
85         int fast_reauth;
86
87         Boolean rxResp /* LEAP only */;
88         Boolean leap_done;
89         Boolean peap_done;
90         u8 req_md5[16]; /* MD5() of the current EAP packet */
91         u8 last_md5[16]; /* MD5() of the previously received EAP packet; used
92                           * in duplicate request detection. */
93
94         void *msg_ctx;
95         void *scard_ctx;
96         void *ssl_ctx;
97
98         unsigned int workaround;
99
100         /* Optional challenges generated in Phase 1 (EAP-FAST) */
101         u8 *peer_challenge, *auth_challenge;
102
103         int num_rounds;
104 };
105
106 #endif /* EAP_I_H */