Replace eap_type_text() with EAP server methods function

While this may not include knowledge of all EAP methods since this
depends on build configuration, it is better to not have to include
ieee802_1x.h into eapol_sm.c.
This commit is contained in:
Jouni Malinen 2009-11-29 18:57:15 +02:00
parent 4dbfe5c58a
commit 2773ca093e
4 changed files with 39 additions and 37 deletions

View file

@ -1,6 +1,6 @@
/*
* hostapd / EAP method registration
* Copyright (c) 2004-2006, Jouni Malinen <j@w1.fi>
* EAP server method registration
* Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@ -306,3 +306,23 @@ void eap_server_unregister_methods(void)
eap_server_method_free(m);
}
}
/**
* eap_server_get_name - Get EAP method name for the given EAP type
* @vendor: EAP Vendor-Id (0 = IETF)
* @type: EAP method type
* Returns: EAP method name, e.g., TLS, or %NULL if not found
*
* 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)
{
struct eap_method *m;
for (m = eap_methods; m; m = m->next) {
if (m->vendor == vendor && m->method == type)
return m->name;
}
return NULL;
}

View file

@ -1,6 +1,6 @@
/*
* hostapd / EAP method registration
* Copyright (c) 2004-2006, Jouni Malinen <j@w1.fi>
* EAP server method registration
* Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@ -25,5 +25,6 @@ int eap_server_method_register(struct eap_method *method);
EapType eap_server_get_type(const char *name, int *vendor);
int eap_server_register_methods(void);
void eap_server_unregister_methods(void);
const char * eap_server_get_name(int vendor, EapType type);
#endif /* EAP_SERVER_METHODS_H */