Disconnect hostapd from building in base
[dragonfly.git] / contrib / hostapd / src / eap_server / eap.h
CommitLineData
a875087d
JL
1/*
2 * hostapd / EAP Full Authenticator state machine (RFC 4137)
3 * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
4 *
4781064b
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
a875087d
JL
7 */
8
9#ifndef EAP_H
10#define EAP_H
11
4781064b 12#include "common/defs.h"
a875087d
JL
13#include "eap_common/eap_defs.h"
14#include "eap_server/eap_methods.h"
15#include "wpabuf.h"
16
17struct eap_sm;
18
a875087d
JL
19#define EAP_TTLS_AUTH_PAP 1
20#define EAP_TTLS_AUTH_CHAP 2
21#define EAP_TTLS_AUTH_MSCHAP 4
22#define EAP_TTLS_AUTH_MSCHAPV2 8
23
24struct eap_user {
25 struct {
26 int vendor;
27 u32 method;
28 } methods[EAP_MAX_METHODS];
29 u8 *password;
30 size_t password_len;
31 int password_hash; /* whether password is hashed with
32 * nt_password_hash() */
33 int phase2;
34 int force_version;
35 int ttls_auth; /* bitfield of
36 * EAP_TTLS_AUTH_{PAP,CHAP,MSCHAP,MSCHAPV2} */
37};
38
39struct eap_eapol_interface {
40 /* Lower layer to full authenticator variables */
41 Boolean eapResp; /* shared with EAPOL Backend Authentication */
42 struct wpabuf *eapRespData;
43 Boolean portEnabled;
44 int retransWhile;
45 Boolean eapRestart; /* shared with EAPOL Authenticator PAE */
46 int eapSRTT;
47 int eapRTTVAR;
48
49 /* Full authenticator to lower layer variables */
50 Boolean eapReq; /* shared with EAPOL Backend Authentication */
51 Boolean eapNoReq; /* shared with EAPOL Backend Authentication */
52 Boolean eapSuccess;
53 Boolean eapFail;
54 Boolean eapTimeout;
55 struct wpabuf *eapReqData;
56 u8 *eapKeyData;
57 size_t eapKeyDataLen;
58 Boolean eapKeyAvailable; /* called keyAvailable in IEEE 802.1X-2004 */
59
60 /* AAA interface to full authenticator variables */
61 Boolean aaaEapReq;
62 Boolean aaaEapNoReq;
63 Boolean aaaSuccess;
64 Boolean aaaFail;
65 struct wpabuf *aaaEapReqData;
66 u8 *aaaEapKeyData;
67 size_t aaaEapKeyDataLen;
68 Boolean aaaEapKeyAvailable;
69 int aaaMethodTimeout;
70
71 /* Full authenticator to AAA interface variables */
72 Boolean aaaEapResp;
73 struct wpabuf *aaaEapRespData;
74 /* aaaIdentity -> eap_get_identity() */
75 Boolean aaaTimeout;
76};
77
78struct eapol_callbacks {
79 int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len,
80 int phase2, struct eap_user *user);
81 const char * (*get_eap_req_id_text)(void *ctx, size_t *len);
82};
83
84struct eap_config {
85 void *ssl_ctx;
4781064b 86 void *msg_ctx;
a875087d
JL
87 void *eap_sim_db_priv;
88 Boolean backend_auth;
89 int eap_server;
4781064b 90 u16 pwd_group;
a875087d
JL
91 u8 *pac_opaque_encr_key;
92 u8 *eap_fast_a_id;
93 size_t eap_fast_a_id_len;
94 char *eap_fast_a_id_info;
95 int eap_fast_prov;
96 int pac_key_lifetime;
97 int pac_key_refresh_time;
98 int eap_sim_aka_result_ind;
99 int tnc;
100 struct wps_context *wps;
101 const struct wpabuf *assoc_wps_ie;
4781064b
JM
102 const struct wpabuf *assoc_p2p_ie;
103 const u8 *peer_addr;
104 int fragment_size;
105
106 int pbc_in_m1;
107
108 const u8 *server_id;
109 size_t server_id_len;
a875087d
JL
110};
111
112
113struct eap_sm * eap_server_sm_init(void *eapol_ctx,
114 struct eapol_callbacks *eapol_cb,
115 struct eap_config *eap_conf);
116void eap_server_sm_deinit(struct eap_sm *sm);
117int eap_server_sm_step(struct eap_sm *sm);
118void eap_sm_notify_cached(struct eap_sm *sm);
119void eap_sm_pending_cb(struct eap_sm *sm);
120int eap_sm_method_pending(struct eap_sm *sm);
121const u8 * eap_get_identity(struct eap_sm *sm, size_t *len);
122struct eap_eapol_interface * eap_get_interface(struct eap_sm *sm);
4781064b 123void eap_server_clear_identity(struct eap_sm *sm);
a875087d
JL
124
125#endif /* EAP_H */