eapol_auth_sm.h revision 214501
1214501Srpaulo/* 2214501Srpaulo * IEEE 802.1X-2004 Authenticator - EAPOL state machine 3214501Srpaulo * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi> 4214501Srpaulo * 5214501Srpaulo * This program is free software; you can redistribute it and/or modify 6214501Srpaulo * it under the terms of the GNU General Public License version 2 as 7214501Srpaulo * published by the Free Software Foundation. 8214501Srpaulo * 9214501Srpaulo * Alternatively, this software may be distributed under the terms of BSD 10214501Srpaulo * license. 11214501Srpaulo * 12214501Srpaulo * See README and COPYING for more details. 13214501Srpaulo */ 14214501Srpaulo 15214501Srpaulo#ifndef EAPOL_AUTH_SM_H 16214501Srpaulo#define EAPOL_AUTH_SM_H 17214501Srpaulo 18214501Srpaulo#define EAPOL_SM_PREAUTH BIT(0) 19214501Srpaulo#define EAPOL_SM_WAIT_START BIT(1) 20214501Srpaulo#define EAPOL_SM_USES_WPA BIT(2) 21214501Srpaulo#define EAPOL_SM_FROM_PMKSA_CACHE BIT(3) 22214501Srpaulo 23214501Srpaulostruct eapol_auth_config { 24214501Srpaulo int eap_reauth_period; 25214501Srpaulo int wpa; 26214501Srpaulo int individual_wep_key_len; 27214501Srpaulo int eap_server; 28214501Srpaulo void *ssl_ctx; 29214501Srpaulo void *msg_ctx; 30214501Srpaulo void *eap_sim_db_priv; 31214501Srpaulo char *eap_req_id_text; /* a copy of this will be allocated */ 32214501Srpaulo size_t eap_req_id_text_len; 33214501Srpaulo u8 *pac_opaque_encr_key; 34214501Srpaulo u8 *eap_fast_a_id; 35214501Srpaulo size_t eap_fast_a_id_len; 36214501Srpaulo char *eap_fast_a_id_info; 37214501Srpaulo int eap_fast_prov; 38214501Srpaulo int pac_key_lifetime; 39214501Srpaulo int pac_key_refresh_time; 40214501Srpaulo int eap_sim_aka_result_ind; 41214501Srpaulo int tnc; 42214501Srpaulo struct wps_context *wps; 43214501Srpaulo 44214501Srpaulo /* Opaque context pointer to owner data for callback functions */ 45214501Srpaulo void *ctx; 46214501Srpaulo}; 47214501Srpaulo 48214501Srpaulostruct eap_user; 49214501Srpaulo 50214501Srpaulotypedef enum { 51214501Srpaulo EAPOL_LOGGER_DEBUG, EAPOL_LOGGER_INFO, EAPOL_LOGGER_WARNING 52214501Srpaulo} eapol_logger_level; 53214501Srpaulo 54214501Srpauloenum eapol_event { 55214501Srpaulo EAPOL_AUTH_SM_CHANGE, 56214501Srpaulo EAPOL_AUTH_REAUTHENTICATE 57214501Srpaulo}; 58214501Srpaulo 59214501Srpaulostruct eapol_auth_cb { 60214501Srpaulo void (*eapol_send)(void *ctx, void *sta_ctx, u8 type, const u8 *data, 61214501Srpaulo size_t datalen); 62214501Srpaulo void (*aaa_send)(void *ctx, void *sta_ctx, const u8 *data, 63214501Srpaulo size_t datalen); 64214501Srpaulo void (*finished)(void *ctx, void *sta_ctx, int success, int preauth); 65214501Srpaulo int (*get_eap_user)(void *ctx, const u8 *identity, size_t identity_len, 66214501Srpaulo int phase2, struct eap_user *user); 67214501Srpaulo int (*sta_entry_alive)(void *ctx, const u8 *addr); 68214501Srpaulo void (*logger)(void *ctx, const u8 *addr, eapol_logger_level level, 69214501Srpaulo const char *txt); 70214501Srpaulo void (*set_port_authorized)(void *ctx, void *sta_ctx, int authorized); 71214501Srpaulo void (*abort_auth)(void *ctx, void *sta_ctx); 72214501Srpaulo void (*tx_key)(void *ctx, void *sta_ctx); 73214501Srpaulo void (*eapol_event)(void *ctx, void *sta_ctx, enum eapol_event type); 74214501Srpaulo}; 75214501Srpaulo 76214501Srpaulo 77214501Srpaulostruct eapol_authenticator * eapol_auth_init(struct eapol_auth_config *conf, 78214501Srpaulo struct eapol_auth_cb *cb); 79214501Srpaulovoid eapol_auth_deinit(struct eapol_authenticator *eapol); 80214501Srpaulostruct eapol_state_machine * 81214501Srpauloeapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr, 82214501Srpaulo int flags, const struct wpabuf *assoc_wps_ie, void *sta_ctx); 83214501Srpaulovoid eapol_auth_free(struct eapol_state_machine *sm); 84214501Srpaulovoid eapol_auth_step(struct eapol_state_machine *sm); 85214501Srpaulovoid eapol_auth_dump_state(FILE *f, const char *prefix, 86214501Srpaulo struct eapol_state_machine *sm); 87214501Srpauloint eapol_auth_eap_pending_cb(struct eapol_state_machine *sm, void *ctx); 88214501Srpaulo 89214501Srpaulo#endif /* EAPOL_AUTH_SM_H */ 90