1/* 2 * WPA Supplicant / dbus-based control interface 3 * Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc. 4 * |
5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. |
7 */ 8 9#include "includes.h" 10#include <dbus/dbus.h> 11 12#include "common.h" 13#include "eap_peer/eap_methods.h" 14#include "common/ieee802_11_defs.h" --- 90 unchanged lines hidden (view full) --- 105 if (!os_strlen(ifname)) 106 goto error; 107 108 /* Second argument: dict of options */ 109 if (dbus_message_iter_next(&iter)) { 110 DBusMessageIter iter_dict; 111 struct wpa_dbus_dict_entry entry; 112 |
113 if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL)) |
114 goto error; 115 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 116 if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) 117 goto error; 118 if (!strcmp(entry.key, "driver") && 119 (entry.type == DBUS_TYPE_STRING)) { 120 driver = os_strdup(entry.str_value); 121 wpa_dbus_dict_entry_clear(&entry); --- 96 unchanged lines hidden (view full) --- 218 } 219 220 wpa_s = wpa_supplicant_get_iface_by_dbus_path(global, path); 221 if (wpa_s == NULL) { 222 reply = wpas_dbus_new_invalid_iface_error(message); 223 goto out; 224 } 225 |
226 if (!wpa_supplicant_remove_iface(global, wpa_s, 0)) { |
227 reply = wpas_dbus_new_success_reply(message); 228 } else { 229 reply = dbus_message_new_error(message, 230 WPAS_ERROR_REMOVE_ERROR, 231 "wpa_supplicant couldn't " 232 "remove this interface."); 233 } 234 --- 91 unchanged lines hidden (view full) --- 326 * 327 * Handler function for "scan" method call of a network device. Requests 328 * that wpa_supplicant perform a wireless scan as soon as possible 329 * on a particular wireless interface. 330 */ 331DBusMessage * wpas_dbus_iface_scan(DBusMessage *message, 332 struct wpa_supplicant *wpa_s) 333{ |
334 wpa_s->scan_req = MANUAL_SCAN_REQ; |
335 wpa_supplicant_req_scan(wpa_s, 0, 0); 336 return wpas_dbus_new_success_reply(message); 337} 338 339 340/** 341 * wpas_dbus_iface_scan_results - Get the results of a recent scan request 342 * @message: Pointer to incoming dbus message --- 568 unchanged lines hidden (view full) --- 911 struct wpa_ssid *ssid) 912{ 913 DBusMessage *reply = NULL; 914 struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING }; 915 DBusMessageIter iter, iter_dict; 916 917 dbus_message_iter_init(message, &iter); 918 |
919 if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL)) { |
920 reply = wpas_dbus_new_invalid_opts_error(message, NULL); 921 goto out; 922 } 923 924 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 925 char *value = NULL; 926 size_t size = 50; 927 int ret; --- 263 unchanged lines hidden (view full) --- 1191 char *opensc_engine_path = NULL; 1192 char *pkcs11_engine_path = NULL; 1193 char *pkcs11_module_path = NULL; 1194 struct wpa_dbus_dict_entry entry; 1195 1196 if (!dbus_message_iter_init(message, &iter)) 1197 goto error; 1198 |
1199 if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL)) |
1200 goto error; 1201 1202 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 1203 if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) 1204 goto error; 1205 if (!strcmp(entry.key, "opensc_engine_path") && 1206 (entry.type == DBUS_TYPE_STRING)) { 1207 opensc_engine_path = os_strdup(entry.str_value); --- 105 unchanged lines hidden (view full) --- 1313 struct wpa_supplicant *wpa_s) 1314{ 1315 DBusMessage *reply = NULL; 1316 struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING }; 1317 DBusMessageIter iter, iter_dict; 1318 1319 dbus_message_iter_init(message, &iter); 1320 |
1321 if (!wpa_dbus_dict_open_read(&iter, &iter_dict, NULL)) |
1322 return wpas_dbus_new_invalid_opts_error(message, NULL); 1323 1324 while (wpa_dbus_dict_has_dict_entry(&iter_dict)) { 1325 struct wpa_config_blob *blob; 1326 1327 if (!wpa_dbus_dict_get_entry(&iter_dict, &entry)) { 1328 reply = wpas_dbus_new_invalid_opts_error(message, 1329 NULL); --- 93 unchanged lines hidden (view full) --- 1423 } 1424 1425 if (err_msg) 1426 return dbus_message_new_error(message, WPAS_ERROR_REMOVE_ERROR, 1427 err_msg); 1428 1429 return wpas_dbus_new_success_reply(message); 1430} |
1431 1432 1433/** 1434 * wpas_dbus_iface_flush - Clear BSS of old or all inactive entries 1435 * @message: Pointer to incoming dbus message 1436 * @wpa_s: %wpa_supplicant data structure 1437 * Returns: a dbus message containing a UINT32 indicating success (1) or 1438 * failure (0), or returns a dbus error message with more information 1439 * 1440 * Handler function for "flush" method call. Handles requests for an 1441 * interface with an optional "age" parameter that specifies the minimum 1442 * age of a BSS to be flushed. 1443 */ 1444DBusMessage * wpas_dbus_iface_flush(DBusMessage *message, 1445 struct wpa_supplicant *wpa_s) 1446{ 1447 int flush_age = 0; 1448 1449 if (os_strlen(dbus_message_get_signature(message)) != 0 && 1450 !dbus_message_get_args(message, NULL, 1451 DBUS_TYPE_INT32, &flush_age, 1452 DBUS_TYPE_INVALID)) { 1453 return wpas_dbus_new_invalid_opts_error(message, NULL); 1454 } 1455 1456 if (flush_age == 0) 1457 wpa_bss_flush(wpa_s); 1458 else 1459 wpa_bss_flush_by_age(wpa_s, flush_age); 1460 1461 return wpas_dbus_new_success_reply(message); 1462} |