aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/dbus/dbus_old_handlers.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-01-02 13:13:25 (GMT)
committerJouni Malinen <j@w1.fi>2010-01-02 13:13:25 (GMT)
commit9734dc17b6b1e9175e23df7ed895c502eb045f80 (patch)
treea4a34abc7b45ffc638413a75dad713b77a0974f6 /wpa_supplicant/dbus/dbus_old_handlers.c
parent8d923a4acfb8c43527cc9fe9571ebf341b8e0502 (diff)
downloadhostap-9734dc17b6b1e9175e23df7ed895c502eb045f80.zip
hostap-9734dc17b6b1e9175e23df7ed895c502eb045f80.tar.gz
hostap-9734dc17b6b1e9175e23df7ed895c502eb045f80.tar.bz2
dbus: Use BSS table instead of raw scan results in older API
Change the old D-Bus API to use the new BSS table instead of raw scan results.
Diffstat (limited to 'wpa_supplicant/dbus/dbus_old_handlers.c')
-rw-r--r--wpa_supplicant/dbus/dbus_old_handlers.c62
1 files changed, 24 insertions, 38 deletions
diff --git a/wpa_supplicant/dbus/dbus_old_handlers.c b/wpa_supplicant/dbus/dbus_old_handlers.c
index ac79440..f9d3bcd 100644
--- a/wpa_supplicant/dbus/dbus_old_handlers.c
+++ b/wpa_supplicant/dbus/dbus_old_handlers.c
@@ -25,6 +25,7 @@
#include "../driver_i.h"
#include "../notify.h"
#include "../wpas_glue.h"
+#include "../bss.h"
#include "dbus_old.h"
#include "dbus_old_handlers.h"
#include "dbus_dict_helpers.h"
@@ -357,15 +358,7 @@ DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
DBusMessage *reply = NULL;
DBusMessageIter iter;
DBusMessageIter sub_iter;
- size_t i;
-
- /* Ensure we've actually got scan results to return */
- if (wpa_s->scan_res == NULL &&
- wpa_supplicant_get_scan_results(wpa_s, NULL, 0) < 0) {
- return dbus_message_new_error(message, WPAS_ERROR_SCAN_ERROR,
- "An error ocurred getting scan "
- "results.");
- }
+ struct wpa_bss *bss;
/* Create and initialize the return message */
reply = dbus_message_new_method_return(message);
@@ -375,26 +368,19 @@ DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
&sub_iter);
/* Loop through scan results and append each result's object path */
- for (i = 0; i < wpa_s->scan_res->num; i++) {
- struct wpa_scan_res *res = wpa_s->scan_res->res[i];
- char *path;
-
- path = os_zalloc(WPAS_DBUS_OBJECT_PATH_MAX);
- if (path == NULL) {
- wpa_printf(MSG_ERROR, "dbus: Not enough memory to "
- "send scan results signal");
- break;
- }
+ dl_list_for_each(bss, &wpa_s->bss_id, struct wpa_bss, list_id) {
+ char path_buf[WPAS_DBUS_OBJECT_PATH_MAX];
+ char *path = path_buf;
+
/* Construct the object path for this network. Note that ':'
* is not a valid character in dbus object paths.
*/
os_snprintf(path, WPAS_DBUS_OBJECT_PATH_MAX,
"%s/" WPAS_DBUS_BSSIDS_PART "/"
WPAS_DBUS_BSSID_FORMAT,
- wpa_s->dbus_path, MAC2STR(res->bssid));
+ wpa_s->dbus_path, MAC2STR(bss->bssid));
dbus_message_iter_append_basic(&sub_iter,
DBUS_TYPE_OBJECT_PATH, &path);
- os_free(path);
}
dbus_message_iter_close_container(&iter, &sub_iter);
@@ -415,9 +401,9 @@ DBusMessage * wpas_dbus_iface_scan_results(DBusMessage *message,
*/
DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
struct wpa_supplicant *wpa_s,
- struct wpa_scan_res *res)
+ struct wpa_bss *bss)
{
- DBusMessage *reply = NULL;
+ DBusMessage *reply;
DBusMessageIter iter, iter_dict;
const u8 *ie;
@@ -429,11 +415,11 @@ DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
goto error;
if (!wpa_dbus_dict_append_byte_array(&iter_dict, "bssid",
- (const char *) res->bssid,
+ (const char *) bss->bssid,
ETH_ALEN))
goto error;
- ie = wpa_scan_get_ie(res, WLAN_EID_SSID);
+ ie = wpa_bss_get_ie(bss, WLAN_EID_SSID);
if (ie) {
if (!wpa_dbus_dict_append_byte_array(&iter_dict, "ssid",
(const char *) (ie + 2),
@@ -441,7 +427,7 @@ DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
goto error;
}
- ie = wpa_scan_get_vendor_ie(res, WPA_IE_VENDOR_TYPE);
+ ie = wpa_bss_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
if (ie) {
if (!wpa_dbus_dict_append_byte_array(&iter_dict, "wpaie",
(const char *) ie,
@@ -449,7 +435,7 @@ DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
goto error;
}
- ie = wpa_scan_get_ie(res, WLAN_EID_RSN);
+ ie = wpa_bss_get_ie(bss, WLAN_EID_RSN);
if (ie) {
if (!wpa_dbus_dict_append_byte_array(&iter_dict, "rsnie",
(const char *) ie,
@@ -457,7 +443,7 @@ DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
goto error;
}
- ie = wpa_scan_get_vendor_ie(res, WPS_IE_VENDOR_TYPE);
+ ie = wpa_bss_get_vendor_ie(bss, WPS_IE_VENDOR_TYPE);
if (ie) {
if (!wpa_dbus_dict_append_byte_array(&iter_dict, "wpsie",
(const char *) ie,
@@ -465,25 +451,25 @@ DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
goto error;
}
- if (res->freq) {
+ if (bss->freq) {
if (!wpa_dbus_dict_append_int32(&iter_dict, "frequency",
- res->freq))
+ bss->freq))
goto error;
}
if (!wpa_dbus_dict_append_uint16(&iter_dict, "capabilities",
- res->caps))
+ bss->caps))
goto error;
- if (!(res->flags & WPA_SCAN_QUAL_INVALID) &&
- !wpa_dbus_dict_append_int32(&iter_dict, "quality", res->qual))
+ if (!(bss->flags & WPA_BSS_QUAL_INVALID) &&
+ !wpa_dbus_dict_append_int32(&iter_dict, "quality", bss->qual))
goto error;
- if (!(res->flags & WPA_SCAN_NOISE_INVALID) &&
- !wpa_dbus_dict_append_int32(&iter_dict, "noise", res->noise))
+ if (!(bss->flags & WPA_BSS_NOISE_INVALID) &&
+ !wpa_dbus_dict_append_int32(&iter_dict, "noise", bss->noise))
goto error;
- if (!(res->flags & WPA_SCAN_LEVEL_INVALID) &&
- !wpa_dbus_dict_append_int32(&iter_dict, "level", res->level))
+ if (!(bss->flags & WPA_BSS_LEVEL_INVALID) &&
+ !wpa_dbus_dict_append_int32(&iter_dict, "level", bss->level))
goto error;
if (!wpa_dbus_dict_append_int32(&iter_dict, "maxrate",
- wpa_scan_get_max_rate(res) * 500000))
+ wpa_bss_get_max_rate(bss) * 500000))
goto error;
if (!wpa_dbus_dict_close_write(&iter, &iter_dict))