aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wpas_glue.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-10-24 16:04:40 (GMT)
committerJouni Malinen <j@w1.fi>2011-10-30 10:04:24 (GMT)
commit81c57e221d46850966ec43e349e79b18e5756ed7 (patch)
tree42cbd1998856c097e81a572eb09f884df53b47ea /wpa_supplicant/wpas_glue.c
parenta9022616ae66d32c2d962261c9bb603511743cf9 (diff)
downloadhostap-81c57e221d46850966ec43e349e79b18e5756ed7.zip
hostap-81c57e221d46850966ec43e349e79b18e5756ed7.tar.gz
hostap-81c57e221d46850966ec43e349e79b18e5756ed7.tar.bz2
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>
Diffstat (limited to 'wpa_supplicant/wpas_glue.c')
-rw-r--r--wpa_supplicant/wpas_glue.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index 4cd2033..69b0cf8 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -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)