LCOV - code coverage report
Current view: top level - wpa_supplicant - notify.c (source / functions) Hit Total Coverage
Test: wpa_supplicant/hostapd combined for hwsim test run 1401264779 Lines: 200 231 86.6 %
Date: 2014-05-28 Functions: 50 59 84.7 %

          Line data    Source code
       1             : /*
       2             :  * wpa_supplicant - Event notifications
       3             :  * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
       4             :  *
       5             :  * This software may be distributed under the terms of the BSD license.
       6             :  * See README for more details.
       7             :  */
       8             : 
       9             : #include "utils/includes.h"
      10             : 
      11             : #include "utils/common.h"
      12             : #include "common/wpa_ctrl.h"
      13             : #include "config.h"
      14             : #include "wpa_supplicant_i.h"
      15             : #include "wps_supplicant.h"
      16             : #include "dbus/dbus_common.h"
      17             : #include "dbus/dbus_old.h"
      18             : #include "dbus/dbus_new.h"
      19             : #include "rsn_supp/wpa.h"
      20             : #include "driver_i.h"
      21             : #include "scan.h"
      22             : #include "p2p_supplicant.h"
      23             : #include "sme.h"
      24             : #include "notify.h"
      25             : 
      26           4 : int wpas_notify_supplicant_initialized(struct wpa_global *global)
      27             : {
      28             : #ifdef CONFIG_DBUS
      29             :         if (global->params.dbus_ctrl_interface) {
      30             :                 global->dbus = wpas_dbus_init(global);
      31             :                 if (global->dbus == NULL)
      32             :                         return -1;
      33             :         }
      34             : #endif /* CONFIG_DBUS */
      35             : 
      36           4 :         return 0;
      37             : }
      38             : 
      39             : 
      40           4 : void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
      41             : {
      42             : #ifdef CONFIG_DBUS
      43             :         if (global->dbus)
      44             :                 wpas_dbus_deinit(global->dbus);
      45             : #endif /* CONFIG_DBUS */
      46           4 : }
      47             : 
      48             : 
      49          69 : int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
      50             : {
      51          69 :         if (wpas_dbus_register_iface(wpa_s))
      52           0 :                 return -1;
      53             : 
      54          69 :         if (wpas_dbus_register_interface(wpa_s))
      55           0 :                 return -1;
      56             : 
      57          69 :         return 0;
      58             : }
      59             : 
      60             : 
      61          69 : void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
      62             : {
      63             :         /* unregister interface in old DBus ctrl iface */
      64          69 :         wpas_dbus_unregister_iface(wpa_s);
      65             : 
      66             :         /* unregister interface in new DBus ctrl iface */
      67          69 :         wpas_dbus_unregister_interface(wpa_s);
      68          69 : }
      69             : 
      70             : 
      71        8484 : void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
      72             :                                enum wpa_states new_state,
      73             :                                enum wpa_states old_state)
      74             : {
      75             :         /* notify the old DBus API */
      76             :         wpa_supplicant_dbus_notify_state_change(wpa_s, new_state,
      77             :                                                 old_state);
      78             : 
      79             :         /* notify the new DBus API */
      80        8484 :         wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
      81             : 
      82             : #ifdef CONFIG_P2P
      83        8484 :         if (new_state == WPA_COMPLETED)
      84         963 :                 wpas_p2p_notif_connected(wpa_s);
      85        7521 :         else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
      86        1263 :                 wpas_p2p_notif_disconnected(wpa_s);
      87             : #endif /* CONFIG_P2P */
      88             : 
      89        8484 :         sme_state_changed(wpa_s);
      90             : 
      91             : #ifdef ANDROID
      92             :         wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
      93             :                      "id=%d state=%d BSSID=" MACSTR " SSID=%s",
      94             :                      wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
      95             :                      new_state,
      96             :                      MAC2STR(wpa_s->bssid),
      97             :                      wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
      98             :                      wpa_ssid_txt(wpa_s->current_ssid->ssid,
      99             :                                   wpa_s->current_ssid->ssid_len) : "");
     100             : #endif /* ANDROID */
     101        8484 : }
     102             : 
     103             : 
     104        1081 : void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
     105             : {
     106        1081 :         wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
     107        1081 : }
     108             : 
     109             : 
     110         593 : void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
     111             : {
     112         593 :         wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
     113         593 : }
     114             : 
     115             : 
     116           6 : void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
     117             : {
     118           6 :         wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
     119           6 : }
     120             : 
     121             : 
     122        2116 : void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
     123             : {
     124        2116 :         wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
     125        2116 : }
     126             : 
     127             : 
     128        1926 : void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
     129             : {
     130        1926 :         wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
     131        1926 : }
     132             : 
     133             : 
     134         550 : void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
     135             :                                          struct wpa_ssid *ssid)
     136             : {
     137         550 :         wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
     138         550 : }
     139             : 
     140             : 
     141         570 : void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
     142             :                                   struct wpa_ssid *ssid)
     143             : {
     144         570 :         wpas_dbus_signal_network_selected(wpa_s, ssid->id);
     145         570 : }
     146             : 
     147             : 
     148          15 : void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
     149             :                                  struct wpa_ssid *ssid,
     150             :                                  enum wpa_ctrl_req_type rtype,
     151             :                                  const char *default_txt)
     152             : {
     153          15 :         wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
     154          15 : }
     155             : 
     156             : 
     157        2394 : void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
     158             : {
     159             :         /* notify the old DBus API */
     160        2394 :         wpa_supplicant_dbus_notify_scanning(wpa_s);
     161             : 
     162             :         /* notify the new DBus API */
     163        2394 :         wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
     164        2394 : }
     165             : 
     166             : 
     167        1083 : void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
     168             : {
     169        1083 :         wpas_dbus_signal_scan_done(wpa_s, success);
     170        1083 : }
     171             : 
     172             : 
     173        1078 : void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
     174             : {
     175             :         /* notify the old DBus API */
     176        1078 :         wpa_supplicant_dbus_notify_scan_results(wpa_s);
     177             : 
     178        1078 :         wpas_wps_notify_scan_results(wpa_s);
     179        1078 : }
     180             : 
     181             : 
     182           1 : void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
     183             :                                 const struct wps_credential *cred)
     184             : {
     185             : #ifdef CONFIG_WPS
     186             :         /* notify the old DBus API */
     187           1 :         wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
     188             :         /* notify the new DBus API */
     189           1 :         wpas_dbus_signal_wps_cred(wpa_s, cred);
     190             : #endif /* CONFIG_WPS */
     191           1 : }
     192             : 
     193             : 
     194          20 : void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
     195             :                                struct wps_event_m2d *m2d)
     196             : {
     197             : #ifdef CONFIG_WPS
     198          20 :         wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
     199             : #endif /* CONFIG_WPS */
     200          20 : }
     201             : 
     202             : 
     203          39 : void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
     204             :                                 struct wps_event_fail *fail)
     205             : {
     206             : #ifdef CONFIG_WPS
     207          39 :         wpas_dbus_signal_wps_event_fail(wpa_s, fail);
     208             : #endif /* CONFIG_WPS */
     209          39 : }
     210             : 
     211             : 
     212         155 : void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
     213             : {
     214             : #ifdef CONFIG_WPS
     215         155 :         wpas_dbus_signal_wps_event_success(wpa_s);
     216             : #endif /* CONFIG_WPS */
     217         155 : }
     218             : 
     219             : 
     220         850 : void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
     221             :                                struct wpa_ssid *ssid)
     222             : {
     223             :         /*
     224             :          * Networks objects created during any P2P activities should not be
     225             :          * exposed out. They might/will confuse certain non-P2P aware
     226             :          * applications since these network objects won't behave like
     227             :          * regular ones.
     228             :          */
     229         850 :         if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s)
     230         744 :                 wpas_dbus_register_network(wpa_s, ssid);
     231         850 : }
     232             : 
     233             : 
     234          31 : void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
     235             :                                         struct wpa_ssid *ssid)
     236             : {
     237             : #ifdef CONFIG_P2P
     238          31 :         wpas_dbus_register_persistent_group(wpa_s, ssid);
     239             : #endif /* CONFIG_P2P */
     240          31 : }
     241             : 
     242             : 
     243           0 : void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
     244             :                                           struct wpa_ssid *ssid)
     245             : {
     246             : #ifdef CONFIG_P2P
     247           0 :         wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
     248             : #endif /* CONFIG_P2P */
     249           0 : }
     250             : 
     251             : 
     252         811 : void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
     253             :                                  struct wpa_ssid *ssid)
     254             : {
     255         811 :         if (wpa_s->next_ssid == ssid)
     256           0 :                 wpa_s->next_ssid = NULL;
     257         811 :         if (wpa_s->wpa)
     258         811 :                 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
     259         811 :         if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s)
     260         744 :                 wpas_dbus_unregister_network(wpa_s, ssid->id);
     261             : #ifdef CONFIG_P2P
     262         811 :         wpas_p2p_network_removed(wpa_s, ssid);
     263             : #endif /* CONFIG_P2P */
     264         811 : }
     265             : 
     266             : 
     267         961 : void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
     268             :                            u8 bssid[], unsigned int id)
     269             : {
     270         961 :         wpas_dbus_register_bss(wpa_s, bssid, id);
     271        5766 :         wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
     272        5766 :                      id, MAC2STR(bssid));
     273         961 : }
     274             : 
     275             : 
     276         961 : void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
     277             :                              u8 bssid[], unsigned int id)
     278             : {
     279         961 :         wpas_dbus_unregister_bss(wpa_s, bssid, id);
     280        5766 :         wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
     281        5766 :                      id, MAC2STR(bssid));
     282         961 : }
     283             : 
     284             : 
     285           3 : void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
     286             :                                   unsigned int id)
     287             : {
     288           3 :         wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
     289           3 : }
     290             : 
     291             : 
     292           0 : void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
     293             :                                     unsigned int id)
     294             : {
     295           0 :         wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
     296             :                                           id);
     297           0 : }
     298             : 
     299             : 
     300           9 : void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
     301             :                                      unsigned int id)
     302             : {
     303           9 :         wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
     304             :                                           id);
     305           9 : }
     306             : 
     307             : 
     308           0 : void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
     309             :                                   unsigned int id)
     310             : {
     311           0 :         wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
     312           0 : }
     313             : 
     314             : 
     315           9 : void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
     316             :                                    unsigned int id)
     317             : {
     318           9 :         wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
     319           9 : }
     320             : 
     321             : 
     322          11 : void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
     323             :                                    unsigned int id)
     324             : {
     325          11 :         wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
     326          11 : }
     327             : 
     328             : 
     329          30 : void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
     330             :                                  unsigned int id)
     331             : {
     332             : #ifdef CONFIG_WPS
     333          30 :         wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
     334             : #endif /* CONFIG_WPS */
     335          30 : }
     336             : 
     337             : 
     338          50 : void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
     339             :                                    unsigned int id)
     340             : {
     341          50 :         wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
     342          50 : }
     343             : 
     344             : 
     345           0 : void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
     346             :                                    unsigned int id)
     347             : {
     348           0 :         wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
     349           0 : }
     350             : 
     351             : 
     352           0 : void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
     353             : {
     354           0 :         wpas_dbus_signal_blob_added(wpa_s, name);
     355           0 : }
     356             : 
     357             : 
     358           0 : void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
     359             : {
     360           0 :         wpas_dbus_signal_blob_removed(wpa_s, name);
     361           0 : }
     362             : 
     363             : 
     364           0 : void wpas_notify_debug_level_changed(struct wpa_global *global)
     365             : {
     366           0 :         wpas_dbus_signal_debug_level_changed(global);
     367           0 : }
     368             : 
     369             : 
     370           0 : void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
     371             : {
     372           0 :         wpas_dbus_signal_debug_timestamp_changed(global);
     373           0 : }
     374             : 
     375             : 
     376           0 : void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
     377             : {
     378           0 :         wpas_dbus_signal_debug_show_keys_changed(global);
     379           0 : }
     380             : 
     381             : 
     382           2 : void wpas_notify_suspend(struct wpa_global *global)
     383             : {
     384             :         struct wpa_supplicant *wpa_s;
     385             : 
     386           2 :         os_get_time(&global->suspend_time);
     387           2 :         wpa_printf(MSG_DEBUG, "System suspend notification");
     388           4 :         for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
     389           2 :                 wpa_drv_suspend(wpa_s);
     390           2 : }
     391             : 
     392             : 
     393           2 : void wpas_notify_resume(struct wpa_global *global)
     394             : {
     395             :         struct os_time now;
     396             :         int slept;
     397             :         struct wpa_supplicant *wpa_s;
     398             : 
     399           2 :         if (global->suspend_time.sec == 0)
     400           0 :                 slept = -1;
     401             :         else {
     402           2 :                 os_get_time(&now);
     403           2 :                 slept = now.sec - global->suspend_time.sec;
     404             :         }
     405           2 :         wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
     406             :                    slept);
     407             : 
     408           4 :         for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
     409           2 :                 wpa_drv_resume(wpa_s);
     410           2 :                 if (wpa_s->wpa_state == WPA_DISCONNECTED)
     411           2 :                         wpa_supplicant_req_scan(wpa_s, 0, 100000);
     412             :         }
     413           2 : }
     414             : 
     415             : 
     416             : #ifdef CONFIG_P2P
     417             : 
     418         313 : void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
     419             :                                   const u8 *dev_addr, int new_device)
     420             : {
     421         313 :         if (new_device) {
     422             :                 /* Create the new peer object */
     423         308 :                 wpas_dbus_register_peer(wpa_s, dev_addr);
     424             :         }
     425             : 
     426             :         /* Notify a new peer has been detected*/
     427         313 :         wpas_dbus_signal_peer_device_found(wpa_s, dev_addr);
     428         313 : }
     429             : 
     430             : 
     431         308 : void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
     432             :                                  const u8 *dev_addr)
     433             : {
     434         308 :         wpas_dbus_unregister_peer(wpa_s, dev_addr);
     435             : 
     436             :         /* Create signal on interface object*/
     437         308 :         wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
     438         308 : }
     439             : 
     440             : 
     441         243 : void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
     442             :                                    const struct wpa_ssid *ssid,
     443             :                                    const char *role)
     444             : {
     445         243 :         wpas_dbus_unregister_p2p_group(wpa_s, ssid);
     446             : 
     447         243 :         wpas_dbus_signal_p2p_group_removed(wpa_s, role);
     448         243 : }
     449             : 
     450             : 
     451          15 : void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
     452             :                                 const u8 *src, u16 dev_passwd_id)
     453             : {
     454          15 :         wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id);
     455          15 : }
     456             : 
     457             : 
     458         153 : void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
     459             :                                       struct p2p_go_neg_results *res)
     460             : {
     461         153 :         wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
     462         153 : }
     463             : 
     464             : 
     465          25 : void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
     466             :                                        int status, const u8 *bssid)
     467             : {
     468          25 :         wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
     469          25 : }
     470             : 
     471             : 
     472          23 : void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
     473             :                                 int freq, const u8 *sa, u8 dialog_token,
     474             :                                 u16 update_indic, const u8 *tlvs,
     475             :                                 size_t tlvs_len)
     476             : {
     477          23 :         wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
     478             :                                         update_indic, tlvs, tlvs_len);
     479          23 : }
     480             : 
     481             : 
     482          23 : void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
     483             :                                  const u8 *sa, u16 update_indic,
     484             :                                  const u8 *tlvs, size_t tlvs_len)
     485             : {
     486          23 :         wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
     487             :                                          tlvs, tlvs_len);
     488          23 : }
     489             : 
     490             : 
     491             : /**
     492             :  * wpas_notify_p2p_provision_discovery - Notification of provision discovery
     493             :  * @dev_addr: Who sent the request or responded to our request.
     494             :  * @request: Will be 1 if request, 0 for response.
     495             :  * @status: Valid only in case of response (0 in case of success)
     496             :  * @config_methods: WPS config methods
     497             :  * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
     498             :  *
     499             :  * This can be used to notify:
     500             :  * - Requests or responses
     501             :  * - Various config methods
     502             :  * - Failure condition in case of response
     503             :  */
     504          47 : void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
     505             :                                          const u8 *dev_addr, int request,
     506             :                                          enum p2p_prov_disc_status status,
     507             :                                          u16 config_methods,
     508             :                                          unsigned int generated_pin)
     509             : {
     510          47 :         wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
     511             :                                                  status, config_methods,
     512             :                                                  generated_pin);
     513          47 : }
     514             : 
     515             : 
     516         230 : void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
     517             :                                    struct wpa_ssid *ssid, int network_id,
     518             :                                    int client)
     519             : {
     520             :         /* Notify a group has been started */
     521         230 :         wpas_dbus_register_p2p_group(wpa_s, ssid);
     522             : 
     523         230 :         wpas_dbus_signal_p2p_group_started(wpa_s, ssid, client, network_id);
     524         230 : }
     525             : 
     526             : 
     527           3 : void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
     528             :                                 struct wps_event_fail *fail)
     529             : {
     530           3 :         wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
     531           3 : }
     532             : 
     533             : #endif /* CONFIG_P2P */
     534             : 
     535             : 
     536         134 : static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
     537             :                                           const u8 *sta,
     538             :                                           const u8 *p2p_dev_addr)
     539             : {
     540             : #ifdef CONFIG_P2P
     541         134 :         wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
     542             : 
     543             :         /*
     544             :          * Register a group member object corresponding to this peer and
     545             :          * emit a PeerJoined signal. This will check if it really is a
     546             :          * P2P group.
     547             :          */
     548         134 :         wpas_dbus_register_p2p_groupmember(wpa_s, sta);
     549             : 
     550             :         /*
     551             :          * Create 'peer-joined' signal on group object -- will also
     552             :          * check P2P itself.
     553             :          */
     554         134 :         wpas_dbus_signal_p2p_peer_joined(wpa_s, sta);
     555             : #endif /* CONFIG_P2P */
     556             : 
     557             :         /* Notify listeners a new station has been authorized */
     558         134 :         wpas_dbus_signal_sta_authorized(wpa_s, sta);
     559         134 : }
     560             : 
     561             : 
     562         134 : static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
     563             :                                             const u8 *sta)
     564             : {
     565             : #ifdef CONFIG_P2P
     566             :         /*
     567             :          * Unregister a group member object corresponding to this peer
     568             :          * if this is a P2P group.
     569             :          */
     570         134 :         wpas_dbus_unregister_p2p_groupmember(wpa_s, sta);
     571             : 
     572             :         /*
     573             :          * Create 'peer-disconnected' signal on group object if this
     574             :          * is a P2P group.
     575             :          */
     576         134 :         wpas_dbus_signal_p2p_peer_disconnected(wpa_s, sta);
     577             : #endif /* CONFIG_P2P */
     578             : 
     579             :         /* Notify listeners a station has been deauthorized */
     580         134 :         wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
     581         134 : }
     582             : 
     583             : 
     584         268 : void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
     585             :                                 const u8 *mac_addr, int authorized,
     586             :                                 const u8 *p2p_dev_addr)
     587             : {
     588         268 :         if (authorized)
     589         134 :                 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
     590             :         else
     591         134 :                 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr);
     592         268 : }
     593             : 
     594             : 
     595         396 : void wpas_notify_certification(struct wpa_supplicant *wpa_s, int depth,
     596             :                                const char *subject, const char *cert_hash,
     597             :                                const struct wpabuf *cert)
     598             : {
     599         396 :         wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
     600             :                 "depth=%d subject='%s'%s%s",
     601             :                 depth, subject,
     602             :                 cert_hash ? " hash=" : "",
     603             :                 cert_hash ? cert_hash : "");
     604             : 
     605         396 :         if (cert) {
     606             :                 char *cert_hex;
     607           3 :                 size_t len = wpabuf_len(cert) * 2 + 1;
     608           3 :                 cert_hex = os_malloc(len);
     609           3 :                 if (cert_hex) {
     610           3 :                         wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert),
     611             :                                          wpabuf_len(cert));
     612           3 :                         wpa_msg_ctrl(wpa_s, MSG_INFO,
     613             :                                      WPA_EVENT_EAP_PEER_CERT
     614             :                                      "depth=%d subject='%s' cert=%s",
     615             :                                      depth, subject, cert_hex);
     616           3 :                         os_free(cert_hex);
     617             :                 }
     618             :         }
     619             : 
     620             :         /* notify the old DBus API */
     621         396 :         wpa_supplicant_dbus_notify_certification(wpa_s, depth, subject,
     622             :                                                  cert_hash, cert);
     623             :         /* notify the new DBus API */
     624         396 :         wpas_dbus_signal_certification(wpa_s, depth, subject, cert_hash, cert);
     625         396 : }
     626             : 
     627             : 
     628         247 : void wpas_notify_preq(struct wpa_supplicant *wpa_s,
     629             :                       const u8 *addr, const u8 *dst, const u8 *bssid,
     630             :                       const u8 *ie, size_t ie_len, u32 ssi_signal)
     631             : {
     632             : #ifdef CONFIG_AP
     633         247 :         wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
     634             : #endif /* CONFIG_AP */
     635         247 : }
     636             : 
     637             : 
     638        2108 : void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
     639             :                             const char *parameter)
     640             : {
     641        2108 :         wpas_dbus_signal_eap_status(wpa_s, status, parameter);
     642        2108 :         wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
     643             :                      "status='%s' parameter='%s'",
     644             :                      status, parameter);
     645        2108 : }

Generated by: LCOV version 1.10