aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wifi_display.c
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2014-09-15 05:04:29 (GMT)
committerJouni Malinen <j@w1.fi>2014-09-28 16:22:23 (GMT)
commitd4177443d4ee1a7c3d325881ab2acca325dca673 (patch)
tree1695f84bcfb423d2ed86e9d95b4eda0e834d8b73 /wpa_supplicant/wifi_display.c
parenta8833b84f46626b6fb9e9f277137f26acc72c64e (diff)
downloadhostap-d4177443d4ee1a7c3d325881ab2acca325dca673.zip
hostap-d4177443d4ee1a7c3d325881ab2acca325dca673.tar.gz
hostap-d4177443d4ee1a7c3d325881ab2acca325dca673.tar.bz2
wifi_display: Add a utility function to get the sub-elements as IEs
This will be useful for DBus API to expose current WFD configuration. Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Diffstat (limited to 'wpa_supplicant/wifi_display.c')
-rw-r--r--wpa_supplicant/wifi_display.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/wpa_supplicant/wifi_display.c b/wpa_supplicant/wifi_display.c
index b6f9236..80c4e13 100644
--- a/wpa_supplicant/wifi_display.c
+++ b/wpa_supplicant/wifi_display.c
@@ -36,6 +36,34 @@ void wifi_display_deinit(struct wpa_global *global)
}
+struct wpabuf * wifi_display_get_wfd_ie(struct wpa_global *global)
+{
+ struct wpabuf *ie;
+ size_t len;
+ int i;
+
+ if (global->p2p == NULL)
+ return NULL;
+
+ len = 0;
+ for (i = 0; i < MAX_WFD_SUBELEMS; i++) {
+ if (global->wfd_subelem[i])
+ len += wpabuf_len(global->wfd_subelem[i]);
+ }
+
+ ie = wpabuf_alloc(len);
+ if (ie == NULL)
+ return NULL;
+
+ for (i = 0; i < MAX_WFD_SUBELEMS; i++) {
+ if (global->wfd_subelem[i])
+ wpabuf_put_buf(ie, global->wfd_subelem[i]);
+ }
+
+ return ie;
+}
+
+
static int wifi_display_update_wfd_ie(struct wpa_global *global)
{
struct wpabuf *ie, *buf;