]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/hostapd/eap.h
This commit was generated by cvs2svn to compensate for changes in r170331,
[FreeBSD/FreeBSD.git] / contrib / hostapd / eap.h
1 /* $FreeBSD$ */
2
3 #ifndef EAP_H
4 #define EAP_H
5
6 #include "defs.h"
7 #include "eap_defs.h"
8
9 struct eap_sm;
10
11 #define EAP_MAX_METHODS 8
12 struct eap_user {
13         u8 methods[EAP_MAX_METHODS];
14         u8 *password;
15         size_t password_len;
16         int phase2;
17         int force_version;
18 };
19
20 enum eapol_bool_var {
21         EAPOL_eapSuccess, EAPOL_eapRestart, EAPOL_eapFail, EAPOL_eapResp,
22         EAPOL_eapReq, EAPOL_eapNoReq, EAPOL_portEnabled, EAPOL_eapTimeout
23 };
24
25 struct eapol_callbacks {
26         Boolean (*get_bool)(void *ctx, enum eapol_bool_var variable);
27         void (*set_bool)(void *ctx, enum eapol_bool_var variable,
28                          Boolean value);
29         void (*set_eapReqData)(void *ctx, const u8 *eapReqData,
30                                size_t eapReqDataLen);
31         void (*set_eapKeyData)(void *ctx, const u8 *eapKeyData,
32                                size_t eapKeyDataLen);
33         int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len,
34                             int phase2, struct eap_user *user);
35         const char * (*get_eap_req_id_text)(void *ctx, size_t *len);
36 };
37
38 struct eap_config {
39         void *ssl_ctx;
40         void *eap_sim_db_priv;
41         Boolean backend_auth;
42 };
43
44
45 #ifdef EAP_SERVER
46
47 struct eap_sm * eap_sm_init(void *eapol_ctx, struct eapol_callbacks *eapol_cb,
48                             struct eap_config *eap_conf);
49 void eap_sm_deinit(struct eap_sm *sm);
50 int eap_sm_step(struct eap_sm *sm);
51 u8 eap_get_type(const char *name);
52 void eap_set_eapRespData(struct eap_sm *sm, const u8 *eapRespData,
53                          size_t eapRespDataLen);
54 void eap_sm_notify_cached(struct eap_sm *sm);
55
56 #else /* EAP_SERVER */
57
58 static inline struct eap_sm * eap_sm_init(void *eapol_ctx,
59                                           struct eapol_callbacks *eapol_cb,
60                                           struct eap_config *eap_conf)
61 {
62         return NULL;
63 }
64
65 static inline void eap_sm_deinit(struct eap_sm *sm)
66 {
67 }
68
69 static inline int eap_sm_step(struct eap_sm *sm)
70 {
71         return 0;
72 }
73
74 static inline u8 eap_get_type(const char *name)
75 {
76         return EAP_TYPE_NONE;
77 }
78
79 static inline void eap_set_eapRespData(struct eap_sm *sm,
80                                        const u8 *eapRespData,
81                                        size_t eapRespDataLen)
82 {
83 }
84
85 static inline void eap_sm_notify_cached(struct eap_sm *sm)
86 {
87 }
88
89 #endif /* EAP_SERVER */
90
91 #endif /* EAP_H */