aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wifi_display.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2014-12-05 13:22:33 (GMT)
committerJouni Malinen <j@w1.fi>2014-12-05 13:22:33 (GMT)
commitbc0ba01d7025962372389e9576ecd878c30c9f20 (patch)
tree5530f9a467b78b3db80bd9518879b1b330aa9885 /wpa_supplicant/wifi_display.c
parentceb767d5011ba935ed72068a0a9240f578183a44 (diff)
downloadhostap-bc0ba01d7025962372389e9576ecd878c30c9f20.zip
hostap-bc0ba01d7025962372389e9576ecd878c30c9f20.tar.gz
hostap-bc0ba01d7025962372389e9576ecd878c30c9f20.tar.bz2
WFD: Allow WFD_SUBELEM_SET/GET all to be used with full IE buffer
This extends the previously used WFD_SUBELEM_SET/GET <subelem id> design to allow special "all" value to be used as an id to indicate that all WFD subelements are to be set/get. This uses similar interface as was previously added over D-Bus. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/wifi_display.c')
-rw-r--r--wpa_supplicant/wifi_display.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/wpa_supplicant/wifi_display.c b/wpa_supplicant/wifi_display.c
index 5c06e42..c363b21 100644
--- a/wpa_supplicant/wifi_display.c
+++ b/wpa_supplicant/wifi_display.c
@@ -233,15 +233,31 @@ int wifi_display_subelem_set(struct wpa_global *global, char *cmd)
if (pos == NULL)
return -1;
*pos++ = '\0';
- subelem = atoi(cmd);
- if (subelem < 0 || subelem >= MAX_WFD_SUBELEMS)
- return -1;
len = os_strlen(pos);
if (len & 1)
return -1;
len /= 2;
+ if (os_strcmp(cmd, "all") == 0) {
+ int res;
+
+ e = wpabuf_alloc(len);
+ if (e == NULL)
+ return -1;
+ if (hexstr2bin(pos, wpabuf_put(e, len), len) < 0) {
+ wpabuf_free(e);
+ return -1;
+ }
+ res = wifi_display_subelem_set_from_ies(global, e);
+ wpabuf_free(e);
+ return res;
+ }
+
+ subelem = atoi(cmd);
+ if (subelem < 0 || subelem >= MAX_WFD_SUBELEMS)
+ return -1;
+
if (len == 0) {
/* Clear subelement */
e = NULL;
@@ -325,6 +341,19 @@ int wifi_display_subelem_get(struct wpa_global *global, char *cmd,
{
int subelem;
+ if (os_strcmp(cmd, "all") == 0) {
+ struct wpabuf *ie;
+ int res;
+
+ ie = wifi_display_get_wfd_ie(global);
+ if (ie == NULL)
+ return 0;
+ res = wpa_snprintf_hex(buf, buflen, wpabuf_head(ie),
+ wpabuf_len(ie));
+ wpabuf_free(ie);
+ return res;
+ }
+
subelem = atoi(cmd);
if (subelem < 0 || subelem >= MAX_WFD_SUBELEMS)
return -1;