$search
00001 /* 00002 * EAP peer state machine functions (RFC 4137) 00003 * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef EAP_H 00016 #define EAP_H 00017 00018 #include "common/defs.h" 00019 #include "eap_common/eap_defs.h" 00020 #include "eap_peer/eap_methods.h" 00021 00022 struct eap_sm; 00023 struct wpa_config_blob; 00024 struct wpabuf; 00025 00026 struct eap_method_type { 00027 int vendor; 00028 u32 method; 00029 }; 00030 00031 #ifdef IEEE8021X_EAPOL 00032 00041 enum eapol_bool_var { 00047 EAPOL_eapSuccess, 00048 00054 EAPOL_eapRestart, 00055 00061 EAPOL_eapFail, 00062 00068 EAPOL_eapResp, 00069 00075 EAPOL_eapNoResp, 00076 00082 EAPOL_eapReq, 00083 00089 EAPOL_portEnabled, 00090 00096 EAPOL_altAccept, 00097 00103 EAPOL_altReject 00104 }; 00105 00114 enum eapol_int_var { 00124 EAPOL_idleWhile 00125 }; 00126 00136 struct eapol_callbacks { 00141 struct eap_peer_config * (*get_config)(void *ctx); 00142 00148 Boolean (*get_bool)(void *ctx, enum eapol_bool_var variable); 00149 00156 void (*set_bool)(void *ctx, enum eapol_bool_var variable, 00157 Boolean value); 00158 00165 unsigned int (*get_int)(void *ctx, enum eapol_int_var variable); 00166 00173 void (*set_int)(void *ctx, enum eapol_int_var variable, 00174 unsigned int value); 00175 00183 struct wpabuf * (*get_eapReqData)(void *ctx); 00184 00193 void (*set_config_blob)(void *ctx, struct wpa_config_blob *blob); 00194 00201 const struct wpa_config_blob * (*get_config_blob)(void *ctx, 00202 const char *name); 00203 00214 void (*notify_pending)(void *ctx); 00215 00222 void (*eap_param_needed)(void *ctx, const char *field, 00223 const char *txt); 00224 }; 00225 00229 struct eap_config { 00235 const char *opensc_engine_path; 00241 const char *pkcs11_engine_path; 00247 const char *pkcs11_module_path; 00253 struct wps_context *wps; 00254 }; 00255 00256 struct eap_sm * eap_peer_sm_init(void *eapol_ctx, 00257 struct eapol_callbacks *eapol_cb, 00258 void *msg_ctx, struct eap_config *conf); 00259 void eap_peer_sm_deinit(struct eap_sm *sm); 00260 int eap_peer_sm_step(struct eap_sm *sm); 00261 void eap_sm_abort(struct eap_sm *sm); 00262 int eap_sm_get_status(struct eap_sm *sm, char *buf, size_t buflen, 00263 int verbose); 00264 struct wpabuf * eap_sm_buildIdentity(struct eap_sm *sm, int id, int encrypted); 00265 void eap_sm_request_identity(struct eap_sm *sm); 00266 void eap_sm_request_password(struct eap_sm *sm); 00267 void eap_sm_request_new_password(struct eap_sm *sm); 00268 void eap_sm_request_pin(struct eap_sm *sm); 00269 void eap_sm_request_otp(struct eap_sm *sm, const char *msg, size_t msg_len); 00270 void eap_sm_request_passphrase(struct eap_sm *sm); 00271 void eap_sm_notify_ctrl_attached(struct eap_sm *sm); 00272 u32 eap_get_phase2_type(const char *name, int *vendor); 00273 struct eap_method_type * eap_get_phase2_types(struct eap_peer_config *config, 00274 size_t *count); 00275 void eap_set_fast_reauth(struct eap_sm *sm, int enabled); 00276 void eap_set_workaround(struct eap_sm *sm, unsigned int workaround); 00277 void eap_set_force_disabled(struct eap_sm *sm, int disabled); 00278 int eap_key_available(struct eap_sm *sm); 00279 void eap_notify_success(struct eap_sm *sm); 00280 void eap_notify_lower_layer_success(struct eap_sm *sm); 00281 const u8 * eap_get_eapKeyData(struct eap_sm *sm, size_t *len); 00282 struct wpabuf * eap_get_eapRespData(struct eap_sm *sm); 00283 void eap_register_scard_ctx(struct eap_sm *sm, void *ctx); 00284 void eap_invalidate_cached_session(struct eap_sm *sm); 00285 00286 int eap_is_wps_pbc_enrollee(struct eap_peer_config *conf); 00287 int eap_is_wps_pin_enrollee(struct eap_peer_config *conf); 00288 00289 #endif /* IEEE8021X_EAPOL */ 00290 00291 #endif /* EAP_H */