Add wpa_supplicant_ctrl_req_from_string()

Converts from a string to a control request enum when input
from a control interface is received. Will be used by a
subsequent patch.

Signed-off-by: Dan Williams <dcbw@redhat.com>
This commit is contained in:
Dan Williams 2011-10-24 11:04:40 -05:00 committed by Jouni Malinen
parent a9022616ae
commit 81c57e221d
3 changed files with 23 additions and 0 deletions

View file

@ -271,6 +271,7 @@ enum hostapd_hw_mode {
* enum wpa_ctrl_req_type - Control interface request types
*/
enum wpa_ctrl_req_type {
WPA_CTRL_REQ_UNKNOWN,
WPA_CTRL_REQ_EAP_IDENTITY,
WPA_CTRL_REQ_EAP_PASSWORD,
WPA_CTRL_REQ_EAP_NEW_PASSWORD,

View file

@ -587,6 +587,24 @@ static int wpa_supplicant_tdls_peer_addset(
#endif /* CONFIG_TDLS */
enum wpa_ctrl_req_type wpa_supplicant_ctrl_req_from_string(const char *field)
{
if (os_strcmp(field, "IDENTITY") == 0)
return WPA_CTRL_REQ_EAP_IDENTITY;
else if (os_strcmp(field, "PASSWORD") == 0)
return WPA_CTRL_REQ_EAP_PASSWORD;
else if (os_strcmp(field, "NEW_PASSWORD") == 0)
return WPA_CTRL_REQ_EAP_NEW_PASSWORD;
else if (os_strcmp(field, "PIN") == 0)
return WPA_CTRL_REQ_EAP_PIN;
else if (os_strcmp(field, "OTP") == 0)
return WPA_CTRL_REQ_EAP_OTP;
else if (os_strcmp(field, "PASSPHRASE") == 0)
return WPA_CTRL_REQ_EAP_PASSPHRASE;
return WPA_CTRL_REQ_UNKNOWN;
}
const char * wpa_supplicant_ctrl_req_to_string(enum wpa_ctrl_req_type field,
const char *default_txt,
const char **txt)

View file

@ -15,6 +15,8 @@
#ifndef WPAS_GLUE_H
#define WPAS_GLUE_H
enum wpa_ctrl_req_type;
int wpa_supplicant_init_eapol(struct wpa_supplicant *wpa_s);
int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s);
void wpa_supplicant_rsn_supp_set_config(struct wpa_supplicant *wpa_s,
@ -24,4 +26,6 @@ const char * wpa_supplicant_ctrl_req_to_string(enum wpa_ctrl_req_type field,
const char *default_txt,
const char **txt);
enum wpa_ctrl_req_type wpa_supplicant_ctrl_req_from_string(const char *field);
#endif /* WPAS_GLUE_H */