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 "eloop.h" 14#include "wps/wps.h" 15#include "../config.h" 16#include "../wpa_supplicant_i.h" 17#include "../bss.h" 18#include "dbus_old.h" 19#include "dbus_old_handlers.h" |
20#include "dbus_common_i.h" 21 22 23/** 24 * wpas_dbus_decompose_object_path - Decompose an interface object path into parts 25 * @path: The dbus object path 26 * @network: (out) the configured network this object path refers to, if any 27 * @bssid: (out) the scanned bssid this object path refers to, if any --- 247 unchanged lines hidden (view full) --- 275#ifdef CONFIG_WPS 276 else if (!os_strcmp(method, "wpsPbc")) 277 reply = wpas_dbus_iface_wps_pbc(message, wpa_s); 278 else if (!os_strcmp(method, "wpsPin")) 279 reply = wpas_dbus_iface_wps_pin(message, wpa_s); 280 else if (!os_strcmp(method, "wpsReg")) 281 reply = wpas_dbus_iface_wps_reg(message, wpa_s); 282#endif /* CONFIG_WPS */ |
283 else if (!os_strcmp(method, "flush")) 284 reply = wpas_dbus_iface_flush(message, wpa_s); |
285 } 286 287 /* If the message was handled, send back the reply */ 288 if (reply) { 289 if (!dbus_message_get_no_reply(message)) 290 dbus_connection_send(connection, reply, NULL); 291 dbus_message_unref(reply); 292 } --- 244 unchanged lines hidden (view full) --- 537} 538#else /* CONFIG_WPS */ 539void wpa_supplicant_dbus_notify_wps_cred(struct wpa_supplicant *wpa_s, 540 const struct wps_credential *cred) 541{ 542} 543#endif /* CONFIG_WPS */ 544 |
545void wpa_supplicant_dbus_notify_certification(struct wpa_supplicant *wpa_s, 546 int depth, const char *subject, 547 const char *cert_hash, 548 const struct wpabuf *cert) 549{ 550 struct wpas_dbus_priv *iface; 551 DBusMessage *_signal = NULL; 552 const char *hash; 553 const char *cert_hex; 554 int cert_hex_len; |
555 |
556 /* Do nothing if the control interface is not turned on */ 557 if (wpa_s->global == NULL) 558 return; 559 iface = wpa_s->global->dbus; 560 if (iface == NULL) 561 return; 562 563 _signal = dbus_message_new_signal(wpa_s->dbus_path, 564 WPAS_DBUS_IFACE_INTERFACE, 565 "Certification"); 566 if (_signal == NULL) { 567 wpa_printf(MSG_ERROR, 568 "dbus: wpa_supplicant_dbus_notify_certification: " 569 "Could not create dbus signal; likely out of " 570 "memory"); 571 return; 572 } 573 574 hash = cert_hash ? cert_hash : ""; 575 cert_hex = cert ? wpabuf_head(cert) : ""; 576 cert_hex_len = cert ? wpabuf_len(cert) : 0; 577 578 if (!dbus_message_append_args(_signal, 579 DBUS_TYPE_INT32,&depth, 580 DBUS_TYPE_STRING, &subject, 581 DBUS_TYPE_STRING, &hash, 582 DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, 583 &cert_hex, cert_hex_len, 584 DBUS_TYPE_INVALID)) { 585 wpa_printf(MSG_ERROR, 586 "dbus: wpa_supplicant_dbus_notify_certification: " 587 "Not enough memory to construct signal"); 588 goto out; 589 } 590 591 dbus_connection_send(iface->con, _signal, NULL); 592 593out: 594 dbus_message_unref(_signal); 595 596} 597 598 |
599/** 600 * wpa_supplicant_dbus_ctrl_iface_init - Initialize dbus control interface 601 * @global: Pointer to global data from wpa_supplicant_init() 602 * Returns: 0 on success, -1 on failure 603 * 604 * Initialize the dbus control interface and start receiving commands from 605 * external programs over the bus. 606 */ --- 137 unchanged lines hidden --- |