Replace EapType typedef with enum eap_type
This cleans up coding style of the EAP implementation by avoiding typedef of an enum hiding the type of the variables. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
542913943e
commit
5f2301a6da
21 changed files with 84 additions and 70 deletions
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
struct eap_method {
|
||||
int vendor;
|
||||
EapType method;
|
||||
enum eap_type method;
|
||||
const char *name;
|
||||
|
||||
void * (*init)(struct eap_sm *sm);
|
||||
|
@ -128,7 +128,7 @@ struct eap_sm {
|
|||
/* Full authenticator state machine local variables */
|
||||
|
||||
/* Long-term (maintained between packets) */
|
||||
EapType currentMethod;
|
||||
enum eap_type currentMethod;
|
||||
int currentId;
|
||||
enum {
|
||||
METHOD_PROPOSED, METHOD_CONTINUE, METHOD_END
|
||||
|
@ -141,7 +141,7 @@ struct eap_sm {
|
|||
Boolean rxResp;
|
||||
Boolean rxInitiate;
|
||||
int respId;
|
||||
EapType respMethod;
|
||||
enum eap_type respMethod;
|
||||
int respVendor;
|
||||
u32 respVendorMethod;
|
||||
Boolean ignore;
|
||||
|
|
|
@ -12,14 +12,15 @@
|
|||
#include "eap_common/eap_defs.h"
|
||||
|
||||
const struct eap_method * eap_server_get_eap_method(int vendor,
|
||||
EapType method);
|
||||
enum eap_type method);
|
||||
struct eap_method * eap_server_method_alloc(int version, int vendor,
|
||||
EapType method, const char *name);
|
||||
enum eap_type method,
|
||||
const char *name);
|
||||
int eap_server_method_register(struct eap_method *method);
|
||||
|
||||
EapType eap_server_get_type(const char *name, int *vendor);
|
||||
enum eap_type eap_server_get_type(const char *name, int *vendor);
|
||||
void eap_server_unregister_methods(void);
|
||||
const char * eap_server_get_name(int vendor, EapType type);
|
||||
const char * eap_server_get_name(int vendor, enum eap_type type);
|
||||
|
||||
/* EAP server method registration calls for statically linked in methods */
|
||||
int eap_server_identity_register(void);
|
||||
|
|
|
@ -37,9 +37,10 @@ static struct wpabuf * eap_sm_buildFailure(struct eap_sm *sm, u8 id);
|
|||
static int eap_sm_nextId(struct eap_sm *sm, int id);
|
||||
static void eap_sm_Policy_update(struct eap_sm *sm, const u8 *nak_list,
|
||||
size_t len);
|
||||
static EapType eap_sm_Policy_getNextMethod(struct eap_sm *sm, int *vendor);
|
||||
static enum eap_type eap_sm_Policy_getNextMethod(struct eap_sm *sm,
|
||||
int *vendor);
|
||||
static int eap_sm_Policy_getDecision(struct eap_sm *sm);
|
||||
static Boolean eap_sm_Policy_doPickUp(struct eap_sm *sm, EapType method);
|
||||
static Boolean eap_sm_Policy_doPickUp(struct eap_sm *sm, enum eap_type method);
|
||||
|
||||
|
||||
static int eap_get_erp_send_reauth_start(struct eap_sm *sm)
|
||||
|
@ -94,7 +95,7 @@ static struct wpabuf * eap_sm_buildInitiateReauthStart(struct eap_sm *sm,
|
|||
}
|
||||
|
||||
msg = eap_msg_alloc(EAP_VENDOR_IETF,
|
||||
(EapType) EAP_ERP_TYPE_REAUTH_START, plen,
|
||||
(enum eap_type) EAP_ERP_TYPE_REAUTH_START, plen,
|
||||
EAP_CODE_INITIATE, id);
|
||||
if (msg == NULL)
|
||||
return NULL;
|
||||
|
@ -541,7 +542,7 @@ SM_STATE(EAP, METHOD_RESPONSE)
|
|||
SM_STATE(EAP, PROPOSE_METHOD)
|
||||
{
|
||||
int vendor;
|
||||
EapType type;
|
||||
enum eap_type type;
|
||||
|
||||
SM_ENTRY(EAP, PROPOSE_METHOD);
|
||||
|
||||
|
@ -720,7 +721,8 @@ static void erp_send_finish_reauth(struct eap_sm *sm,
|
|||
plen = 1 + 2 + 2 + os_strlen(nai);
|
||||
if (hash_len)
|
||||
plen += 1 + hash_len;
|
||||
msg = eap_msg_alloc(EAP_VENDOR_IETF, (EapType) EAP_ERP_TYPE_REAUTH,
|
||||
msg = eap_msg_alloc(EAP_VENDOR_IETF,
|
||||
(enum eap_type) EAP_ERP_TYPE_REAUTH,
|
||||
plen, EAP_CODE_FINISH, id);
|
||||
if (msg == NULL)
|
||||
return;
|
||||
|
@ -805,7 +807,8 @@ SM_STATE(EAP, INITIATE_RECEIVED)
|
|||
|
||||
sm->rxInitiate = FALSE;
|
||||
|
||||
pos = eap_hdr_validate(EAP_VENDOR_IETF, (EapType) EAP_ERP_TYPE_REAUTH,
|
||||
pos = eap_hdr_validate(EAP_VENDOR_IETF,
|
||||
(enum eap_type) EAP_ERP_TYPE_REAUTH,
|
||||
sm->eap_if.eapRespData, &len);
|
||||
if (pos == NULL) {
|
||||
wpa_printf(MSG_INFO, "EAP-Initiate: Invalid frame");
|
||||
|
@ -1669,9 +1672,9 @@ static void eap_sm_Policy_update(struct eap_sm *sm, const u8 *nak_list,
|
|||
}
|
||||
|
||||
|
||||
static EapType eap_sm_Policy_getNextMethod(struct eap_sm *sm, int *vendor)
|
||||
static enum eap_type eap_sm_Policy_getNextMethod(struct eap_sm *sm, int *vendor)
|
||||
{
|
||||
EapType next;
|
||||
enum eap_type next;
|
||||
int idx = sm->user_eap_method_index;
|
||||
|
||||
/* In theory, there should be no problems with starting
|
||||
|
@ -1783,7 +1786,7 @@ static int eap_sm_Policy_getDecision(struct eap_sm *sm)
|
|||
}
|
||||
|
||||
|
||||
static Boolean eap_sm_Policy_doPickUp(struct eap_sm *sm, EapType method)
|
||||
static Boolean eap_sm_Policy_doPickUp(struct eap_sm *sm, enum eap_type method)
|
||||
{
|
||||
return method == EAP_TYPE_IDENTITY ? TRUE : FALSE;
|
||||
}
|
||||
|
|
|
@ -108,8 +108,8 @@ static void eap_fast_state(struct eap_fast_data *data, int state)
|
|||
}
|
||||
|
||||
|
||||
static EapType eap_fast_req_failure(struct eap_sm *sm,
|
||||
struct eap_fast_data *data)
|
||||
static enum eap_type eap_fast_req_failure(struct eap_sm *sm,
|
||||
struct eap_fast_data *data)
|
||||
{
|
||||
/* TODO: send Result TLV(FAILURE) */
|
||||
eap_fast_state(data, FAILURE);
|
||||
|
@ -943,7 +943,7 @@ static Boolean eap_fast_check(struct eap_sm *sm, void *priv,
|
|||
|
||||
|
||||
static int eap_fast_phase2_init(struct eap_sm *sm, struct eap_fast_data *data,
|
||||
EapType eap_type)
|
||||
enum eap_type eap_type)
|
||||
{
|
||||
if (data->phase2_priv && data->phase2_method) {
|
||||
data->phase2_method->reset(sm, data->phase2_priv);
|
||||
|
|
|
@ -22,7 +22,8 @@ static struct eap_method *eap_methods;
|
|||
* @method: EAP type number
|
||||
* Returns: Pointer to EAP method or %NULL if not found
|
||||
*/
|
||||
const struct eap_method * eap_server_get_eap_method(int vendor, EapType method)
|
||||
const struct eap_method * eap_server_get_eap_method(int vendor,
|
||||
enum eap_type method)
|
||||
{
|
||||
struct eap_method *m;
|
||||
for (m = eap_methods; m; m = m->next) {
|
||||
|
@ -42,7 +43,7 @@ const struct eap_method * eap_server_get_eap_method(int vendor, EapType method)
|
|||
* This function maps EAP type names into EAP type numbers based on the list of
|
||||
* EAP methods included in the build.
|
||||
*/
|
||||
EapType eap_server_get_type(const char *name, int *vendor)
|
||||
enum eap_type eap_server_get_type(const char *name, int *vendor)
|
||||
{
|
||||
struct eap_method *m;
|
||||
for (m = eap_methods; m; m = m->next) {
|
||||
|
@ -69,7 +70,8 @@ EapType eap_server_get_type(const char *name, int *vendor)
|
|||
* is not needed anymore.
|
||||
*/
|
||||
struct eap_method * eap_server_method_alloc(int version, int vendor,
|
||||
EapType method, const char *name)
|
||||
enum eap_type method,
|
||||
const char *name)
|
||||
{
|
||||
struct eap_method *eap;
|
||||
eap = os_zalloc(sizeof(*eap));
|
||||
|
@ -163,7 +165,7 @@ void eap_server_unregister_methods(void)
|
|||
* This function maps EAP type numbers into EAP type names based on the list of
|
||||
* EAP methods included in the build.
|
||||
*/
|
||||
const char * eap_server_get_name(int vendor, EapType type)
|
||||
const char * eap_server_get_name(int vendor, enum eap_type type)
|
||||
{
|
||||
struct eap_method *m;
|
||||
if (vendor == EAP_VENDOR_IETF && type == EAP_TYPE_EXPANDED)
|
||||
|
|
|
@ -585,7 +585,7 @@ static Boolean eap_peap_check(struct eap_sm *sm, void *priv,
|
|||
|
||||
|
||||
static int eap_peap_phase2_init(struct eap_sm *sm, struct eap_peap_data *data,
|
||||
int vendor, EapType eap_type)
|
||||
int vendor, enum eap_type eap_type)
|
||||
{
|
||||
if (data->phase2_priv && data->phase2_method) {
|
||||
data->phase2_method->reset(sm, data->phase2_priv);
|
||||
|
|
|
@ -121,8 +121,8 @@ static void eap_teap_state(struct eap_teap_data *data, int state)
|
|||
}
|
||||
|
||||
|
||||
static EapType eap_teap_req_failure(struct eap_teap_data *data,
|
||||
enum teap_error_codes error)
|
||||
static enum eap_type eap_teap_req_failure(struct eap_teap_data *data,
|
||||
enum teap_error_codes error)
|
||||
{
|
||||
eap_teap_state(data, FAILURE_SEND_RESULT);
|
||||
return EAP_TYPE_NONE;
|
||||
|
@ -938,7 +938,7 @@ static Boolean eap_teap_check(struct eap_sm *sm, void *priv,
|
|||
|
||||
|
||||
static int eap_teap_phase2_init(struct eap_sm *sm, struct eap_teap_data *data,
|
||||
EapType eap_type)
|
||||
enum eap_type eap_type)
|
||||
{
|
||||
if (data->phase2_priv && data->phase2_method) {
|
||||
data->phase2_method->reset(sm, data->phase2_priv);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
static void eap_server_tls_free_in_buf(struct eap_ssl_data *data);
|
||||
|
||||
|
||||
struct wpabuf * eap_tls_msg_alloc(EapType type, size_t payload_len,
|
||||
struct wpabuf * eap_tls_msg_alloc(enum eap_type type, size_t payload_len,
|
||||
u8 code, u8 identifier)
|
||||
{
|
||||
if (type == EAP_UNAUTH_TLS_TYPE)
|
||||
|
|
|
@ -827,7 +827,7 @@ static void eap_ttls_process_phase2_mschapv2(struct eap_sm *sm,
|
|||
|
||||
static int eap_ttls_phase2_eap_init(struct eap_sm *sm,
|
||||
struct eap_ttls_data *data,
|
||||
EapType eap_type)
|
||||
enum eap_type eap_type)
|
||||
{
|
||||
if (data->phase2_priv && data->phase2_method) {
|
||||
data->phase2_method->reset(sm, data->phase2_priv);
|
||||
|
|
|
@ -73,7 +73,7 @@ struct eap_ssl_data {
|
|||
#define EAP_WFA_UNAUTH_TLS_TYPE 254
|
||||
|
||||
|
||||
struct wpabuf * eap_tls_msg_alloc(EapType type, size_t payload_len,
|
||||
struct wpabuf * eap_tls_msg_alloc(enum eap_type type, size_t payload_len,
|
||||
u8 code, u8 identifier);
|
||||
int eap_server_tls_ssl_init(struct eap_sm *sm, struct eap_ssl_data *data,
|
||||
int verify_peer, int eap_type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue