Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 1 | /* |
| 2 | * WPA Supplicant - Aidl entry point to wpa_supplicant core |
| 3 | * Copyright (c) 2021, Google Inc. All rights reserved. |
| 4 | * |
| 5 | * This software may be distributed under the terms of the BSD license. |
| 6 | * See README for more details. |
| 7 | */ |
| 8 | |
| 9 | #include <android/binder_process.h> |
| 10 | #include <android/binder_manager.h> |
| 11 | |
| 12 | #include "aidl_manager.h" |
| 13 | |
| 14 | extern "C" |
| 15 | { |
| 16 | #include "aidl.h" |
| 17 | #include "aidl_i.h" |
| 18 | #include "utils/common.h" |
| 19 | #include "utils/eloop.h" |
| 20 | #include "utils/includes.h" |
| 21 | #include "dpp.h" |
| 22 | } |
| 23 | |
| 24 | using aidl::android::hardware::wifi::supplicant::AidlManager; |
Gabriel Biren | 3a2ec2c | 2022-03-07 17:59:41 +0000 | [diff] [blame] | 25 | using aidl::android::hardware::wifi::supplicant::AuxiliarySupplicantEventCode; |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 26 | using aidl::android::hardware::wifi::supplicant::DppEventType; |
| 27 | using aidl::android::hardware::wifi::supplicant::DppFailureCode; |
| 28 | using aidl::android::hardware::wifi::supplicant::DppProgressCode; |
| 29 | |
| 30 | static void wpas_aidl_notify_dpp_failure(struct wpa_supplicant *wpa_s, DppFailureCode code); |
| 31 | static void wpas_aidl_notify_dpp_progress(struct wpa_supplicant *wpa_s, DppProgressCode code); |
| 32 | static void wpas_aidl_notify_dpp_success(struct wpa_supplicant *wpa_s, DppEventType code); |
| 33 | |
| 34 | void wpas_aidl_sock_handler( |
| 35 | int /* sock */, void * /* eloop_ctx */, void * /* sock_ctx */) |
| 36 | { |
| 37 | ABinderProcess_handlePolledCommands(); |
| 38 | } |
| 39 | |
| 40 | struct wpas_aidl_priv *wpas_aidl_init(struct wpa_global *global) |
| 41 | { |
| 42 | struct wpas_aidl_priv *priv; |
| 43 | AidlManager *aidl_manager; |
| 44 | |
| 45 | priv = (wpas_aidl_priv *)os_zalloc(sizeof(*priv)); |
| 46 | if (!priv) |
| 47 | return NULL; |
| 48 | priv->global = global; |
| 49 | |
| 50 | wpa_printf(MSG_DEBUG, "Initing aidl control"); |
| 51 | |
| 52 | ABinderProcess_setupPolling(&priv->aidl_fd); |
| 53 | if (priv->aidl_fd < 0) |
| 54 | goto err; |
| 55 | |
| 56 | wpa_printf(MSG_INFO, "Processing aidl events on FD %d", priv->aidl_fd); |
| 57 | // Look for read events from the aidl socket in the eloop. |
| 58 | if (eloop_register_read_sock( |
| 59 | priv->aidl_fd, wpas_aidl_sock_handler, global, priv) < 0) |
| 60 | goto err; |
| 61 | |
| 62 | aidl_manager = AidlManager::getInstance(); |
| 63 | if (!aidl_manager) |
| 64 | goto err; |
| 65 | if (aidl_manager->registerAidlService(global)) { |
| 66 | goto err; |
| 67 | } |
| 68 | // We may not need to store this aidl manager reference in the |
| 69 | // global data strucure because we've made it a singleton class. |
| 70 | priv->aidl_manager = (void *)aidl_manager; |
| 71 | |
| 72 | return priv; |
| 73 | err: |
| 74 | wpas_aidl_deinit(priv); |
| 75 | return NULL; |
| 76 | } |
| 77 | |
| 78 | void wpas_aidl_deinit(struct wpas_aidl_priv *priv) |
| 79 | { |
| 80 | if (!priv) |
| 81 | return; |
| 82 | |
| 83 | wpa_printf(MSG_DEBUG, "Deiniting aidl control"); |
| 84 | |
| 85 | AidlManager::destroyInstance(); |
| 86 | eloop_unregister_read_sock(priv->aidl_fd); |
| 87 | os_free(priv); |
| 88 | } |
| 89 | |
| 90 | int wpas_aidl_register_interface(struct wpa_supplicant *wpa_s) |
| 91 | { |
| 92 | if (!wpa_s || !wpa_s->global->aidl) |
| 93 | return 1; |
| 94 | |
| 95 | wpa_printf( |
| 96 | MSG_DEBUG, "Registering interface to aidl control: %s", |
| 97 | wpa_s->ifname); |
| 98 | |
| 99 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 100 | if (!aidl_manager) |
| 101 | return 1; |
| 102 | |
| 103 | return aidl_manager->registerInterface(wpa_s); |
| 104 | } |
| 105 | |
| 106 | int wpas_aidl_unregister_interface(struct wpa_supplicant *wpa_s) |
| 107 | { |
| 108 | if (!wpa_s || !wpa_s->global->aidl) |
| 109 | return 1; |
| 110 | |
| 111 | wpa_printf( |
| 112 | MSG_DEBUG, "Deregistering interface from aidl control: %s", |
| 113 | wpa_s->ifname); |
| 114 | |
| 115 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 116 | if (!aidl_manager) |
| 117 | return 1; |
| 118 | |
| 119 | return aidl_manager->unregisterInterface(wpa_s); |
| 120 | } |
| 121 | |
| 122 | int wpas_aidl_register_network( |
| 123 | struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) |
| 124 | { |
| 125 | if (!wpa_s || !wpa_s->global->aidl || !ssid) |
| 126 | return 1; |
| 127 | |
| 128 | wpa_printf( |
| 129 | MSG_DEBUG, "Registering network to aidl control: %d", ssid->id); |
| 130 | |
| 131 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 132 | if (!aidl_manager) |
| 133 | return 1; |
| 134 | |
| 135 | return aidl_manager->registerNetwork(wpa_s, ssid); |
| 136 | } |
| 137 | |
| 138 | int wpas_aidl_unregister_network( |
| 139 | struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) |
| 140 | { |
| 141 | if (!wpa_s || !wpa_s->global->aidl || !ssid) |
| 142 | return 1; |
| 143 | |
| 144 | wpa_printf( |
| 145 | MSG_DEBUG, "Deregistering network from aidl control: %d", ssid->id); |
| 146 | |
| 147 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 148 | if (!aidl_manager) |
| 149 | return 1; |
| 150 | |
| 151 | return aidl_manager->unregisterNetwork(wpa_s, ssid); |
| 152 | } |
| 153 | |
| 154 | int wpas_aidl_notify_state_changed(struct wpa_supplicant *wpa_s) |
| 155 | { |
| 156 | if (!wpa_s || !wpa_s->global->aidl) |
| 157 | return 1; |
| 158 | |
| 159 | wpa_printf( |
| 160 | MSG_DEBUG, "Notifying state change event to aidl control: %d", |
| 161 | wpa_s->wpa_state); |
| 162 | |
| 163 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 164 | if (!aidl_manager) |
| 165 | return 1; |
| 166 | |
| 167 | return aidl_manager->notifyStateChange(wpa_s); |
| 168 | } |
| 169 | |
| 170 | int wpas_aidl_notify_network_request( |
| 171 | struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, |
| 172 | enum wpa_ctrl_req_type rtype, const char *default_txt) |
| 173 | { |
| 174 | if (!wpa_s || !wpa_s->global->aidl || !ssid) |
| 175 | return 1; |
| 176 | |
| 177 | wpa_printf( |
| 178 | MSG_DEBUG, "Notifying network request to aidl control: %d", |
| 179 | ssid->id); |
| 180 | |
| 181 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 182 | if (!aidl_manager) |
| 183 | return 1; |
| 184 | |
| 185 | return aidl_manager->notifyNetworkRequest( |
| 186 | wpa_s, ssid, rtype, default_txt); |
| 187 | } |
| 188 | |
Steven Liu | 850c2e0 | 2022-11-28 17:26:39 +0000 | [diff] [blame] | 189 | void wpas_aidl_notify_permanent_id_req_denied( |
| 190 | struct wpa_supplicant *wpa_s) |
| 191 | { |
| 192 | if (!wpa_s || !wpa_s->global->aidl) |
| 193 | return; |
| 194 | |
| 195 | wpa_printf(MSG_DEBUG, "Notifying permanent_id_req denied to aidl control."); |
| 196 | |
| 197 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 198 | if (!aidl_manager) |
| 199 | return; |
| 200 | |
| 201 | return aidl_manager->notifyPermanentIdReqDenied(wpa_s); |
| 202 | } |
| 203 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 204 | void wpas_aidl_notify_anqp_query_done( |
| 205 | struct wpa_supplicant *wpa_s, const u8 *bssid, const char *result, |
| 206 | const struct wpa_bss_anqp *anqp) |
| 207 | { |
| 208 | if (!wpa_s || !wpa_s->global->aidl || !bssid || !result || !anqp) |
| 209 | return; |
| 210 | |
| 211 | wpa_printf( |
| 212 | MSG_DEBUG, |
| 213 | "Notifying ANQP query done to aidl control: " MACSTR "result: %s", |
| 214 | MAC2STR(bssid), result); |
| 215 | |
| 216 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 217 | if (!aidl_manager) |
| 218 | return; |
| 219 | |
| 220 | aidl_manager->notifyAnqpQueryDone(wpa_s, bssid, result, anqp); |
| 221 | } |
| 222 | |
| 223 | void wpas_aidl_notify_hs20_icon_query_done( |
| 224 | struct wpa_supplicant *wpa_s, const u8 *bssid, const char *file_name, |
| 225 | const u8 *image, u32 image_length) |
| 226 | { |
| 227 | if (!wpa_s || !wpa_s->global->aidl || !bssid || !file_name || !image) |
| 228 | return; |
| 229 | |
| 230 | wpa_printf( |
| 231 | MSG_DEBUG, |
| 232 | "Notifying HS20 icon query done to aidl control: " MACSTR |
| 233 | "file_name: %s", |
| 234 | MAC2STR(bssid), file_name); |
| 235 | |
| 236 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 237 | if (!aidl_manager) |
| 238 | return; |
| 239 | |
| 240 | aidl_manager->notifyHs20IconQueryDone( |
| 241 | wpa_s, bssid, file_name, image, image_length); |
| 242 | } |
| 243 | |
| 244 | void wpas_aidl_notify_hs20_rx_subscription_remediation( |
| 245 | struct wpa_supplicant *wpa_s, const char *url, u8 osu_method) |
| 246 | { |
| 247 | if (!wpa_s || !wpa_s->global->aidl || !url) |
| 248 | return; |
| 249 | |
| 250 | wpa_printf( |
| 251 | MSG_DEBUG, |
| 252 | "Notifying HS20 subscription remediation rx to aidl control: %s", |
| 253 | url); |
| 254 | |
| 255 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 256 | if (!aidl_manager) |
| 257 | return; |
| 258 | |
| 259 | aidl_manager->notifyHs20RxSubscriptionRemediation( |
| 260 | wpa_s, url, osu_method); |
| 261 | } |
| 262 | |
| 263 | void wpas_aidl_notify_hs20_rx_deauth_imminent_notice( |
| 264 | struct wpa_supplicant *wpa_s, u8 code, u16 reauth_delay, const char *url) |
| 265 | { |
| 266 | if (!wpa_s || !wpa_s->global->aidl) |
| 267 | return; |
| 268 | |
| 269 | wpa_printf( |
| 270 | MSG_DEBUG, |
| 271 | "Notifying HS20 deauth imminent notice rx to aidl control: %s", |
| 272 | url ? url : "<no URL>"); |
| 273 | |
| 274 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 275 | if (!aidl_manager) |
| 276 | return; |
| 277 | |
| 278 | aidl_manager->notifyHs20RxDeauthImminentNotice( |
| 279 | wpa_s, code, reauth_delay, url); |
| 280 | } |
| 281 | |
| 282 | void wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance( |
| 283 | struct wpa_supplicant *wpa_s, const char *url) |
| 284 | { |
| 285 | if (!wpa_s || !wpa_s->global->aidl || !url) |
| 286 | return; |
| 287 | |
| 288 | wpa_printf(MSG_DEBUG, |
| 289 | "Notifying HS20 terms and conditions acceptance rx to aidl control: %s", |
| 290 | url); |
| 291 | |
| 292 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 293 | if (!aidl_manager) |
| 294 | return; |
| 295 | |
| 296 | aidl_manager->notifyHs20RxTermsAndConditionsAcceptance(wpa_s, url); |
| 297 | } |
| 298 | |
| 299 | void wpas_aidl_notify_disconnect_reason(struct wpa_supplicant *wpa_s) |
| 300 | { |
| 301 | if (!wpa_s) |
| 302 | return; |
| 303 | |
| 304 | wpa_printf( |
| 305 | MSG_DEBUG, "Notifying disconnect reason to aidl control: %d", |
| 306 | wpa_s->disconnect_reason); |
| 307 | |
| 308 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 309 | if (!aidl_manager) |
| 310 | return; |
| 311 | |
| 312 | aidl_manager->notifyDisconnectReason(wpa_s); |
| 313 | } |
| 314 | |
Veerendranath Jakkam | bc2fa49 | 2023-05-25 01:26:50 +0530 | [diff] [blame^] | 315 | void wpas_aidl_notify_mlo_info_change_reason(struct wpa_supplicant *wpa_s, |
| 316 | enum mlo_info_change_reason reason) |
| 317 | { |
| 318 | if (!wpa_s) |
| 319 | return; |
| 320 | |
| 321 | wpa_printf(MSG_DEBUG, "Notifying MLO info change reason to aidl control: %d", |
| 322 | reason); |
| 323 | |
| 324 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 325 | if (!aidl_manager) |
| 326 | return; |
| 327 | |
| 328 | aidl_manager->notifyMloLinksInfoChanged(wpa_s, reason); |
| 329 | } |
| 330 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 331 | void wpas_aidl_notify_assoc_reject(struct wpa_supplicant *wpa_s, |
| 332 | const u8 *bssid, u8 timed_out, const u8 *assoc_resp_ie, size_t assoc_resp_ie_len) |
| 333 | { |
| 334 | if (!wpa_s) |
| 335 | return; |
| 336 | |
| 337 | wpa_printf( |
| 338 | MSG_DEBUG, "Notifying assoc reject to aidl control: %d", |
| 339 | wpa_s->assoc_status_code); |
| 340 | |
| 341 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 342 | if (!aidl_manager) |
| 343 | return; |
| 344 | |
| 345 | aidl_manager->notifyAssocReject(wpa_s, bssid, timed_out, assoc_resp_ie, assoc_resp_ie_len); |
| 346 | } |
| 347 | |
| 348 | void wpas_aidl_notify_auth_timeout(struct wpa_supplicant *wpa_s) |
| 349 | { |
| 350 | if (!wpa_s) |
| 351 | return; |
| 352 | |
| 353 | wpa_printf(MSG_DEBUG, "Notifying auth timeout to aidl control"); |
| 354 | |
| 355 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 356 | if (!aidl_manager) |
| 357 | return; |
| 358 | |
| 359 | aidl_manager->notifyAuthTimeout(wpa_s); |
| 360 | } |
| 361 | |
| 362 | void wpas_aidl_notify_bssid_changed(struct wpa_supplicant *wpa_s) |
| 363 | { |
| 364 | if (!wpa_s) |
| 365 | return; |
| 366 | |
| 367 | wpa_printf(MSG_DEBUG, "Notifying bssid changed to aidl control"); |
| 368 | |
| 369 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 370 | if (!aidl_manager) |
| 371 | return; |
| 372 | |
| 373 | aidl_manager->notifyBssidChanged(wpa_s); |
| 374 | } |
| 375 | |
| 376 | void wpas_aidl_notify_wps_event_fail( |
| 377 | struct wpa_supplicant *wpa_s, uint8_t *peer_macaddr, uint16_t config_error, |
| 378 | uint16_t error_indication) |
| 379 | { |
| 380 | if (!wpa_s || !peer_macaddr) |
| 381 | return; |
| 382 | |
| 383 | wpa_printf( |
| 384 | MSG_DEBUG, "Notifying Wps event fail to aidl control: %d, %d", |
| 385 | config_error, error_indication); |
| 386 | |
| 387 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 388 | if (!aidl_manager) |
| 389 | return; |
| 390 | |
| 391 | aidl_manager->notifyWpsEventFail( |
| 392 | wpa_s, peer_macaddr, config_error, error_indication); |
| 393 | } |
| 394 | |
| 395 | void wpas_aidl_notify_wps_event_success(struct wpa_supplicant *wpa_s) |
| 396 | { |
| 397 | if (!wpa_s) |
| 398 | return; |
| 399 | |
| 400 | wpa_printf(MSG_DEBUG, "Notifying Wps event success to aidl control"); |
| 401 | |
| 402 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 403 | if (!aidl_manager) |
| 404 | return; |
| 405 | |
| 406 | aidl_manager->notifyWpsEventSuccess(wpa_s); |
| 407 | } |
| 408 | |
| 409 | void wpas_aidl_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s) |
| 410 | { |
| 411 | if (!wpa_s) |
| 412 | return; |
| 413 | |
| 414 | wpa_printf( |
| 415 | MSG_DEBUG, "Notifying Wps event PBC overlap to aidl control"); |
| 416 | |
| 417 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 418 | if (!aidl_manager) |
| 419 | return; |
| 420 | |
| 421 | aidl_manager->notifyWpsEventPbcOverlap(wpa_s); |
| 422 | } |
| 423 | |
| 424 | void wpas_aidl_notify_p2p_device_found( |
| 425 | struct wpa_supplicant *wpa_s, const u8 *addr, |
| 426 | const struct p2p_peer_info *info, const u8 *peer_wfd_device_info, |
| 427 | u8 peer_wfd_device_info_len, const u8 *peer_wfd_r2_device_info, |
| 428 | u8 peer_wfd_r2_device_info_len) |
| 429 | { |
| 430 | if (!wpa_s || !addr || !info) |
| 431 | return; |
| 432 | |
| 433 | wpa_printf( |
| 434 | MSG_DEBUG, "Notifying P2P device found to aidl control " MACSTR, |
| 435 | MAC2STR(info->p2p_device_addr)); |
| 436 | |
| 437 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 438 | if (!aidl_manager) |
| 439 | return; |
| 440 | |
| 441 | aidl_manager->notifyP2pDeviceFound( |
| 442 | wpa_s, addr, info, peer_wfd_device_info, |
| 443 | peer_wfd_device_info_len, peer_wfd_r2_device_info, |
| 444 | peer_wfd_r2_device_info_len); |
| 445 | } |
| 446 | |
| 447 | void wpas_aidl_notify_p2p_device_lost( |
| 448 | struct wpa_supplicant *wpa_s, const u8 *p2p_device_addr) |
| 449 | { |
| 450 | if (!wpa_s || !p2p_device_addr) |
| 451 | return; |
| 452 | |
| 453 | wpa_printf( |
| 454 | MSG_DEBUG, "Notifying P2P device lost to aidl control " MACSTR, |
| 455 | MAC2STR(p2p_device_addr)); |
| 456 | |
| 457 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 458 | if (!aidl_manager) |
| 459 | return; |
| 460 | |
| 461 | aidl_manager->notifyP2pDeviceLost(wpa_s, p2p_device_addr); |
| 462 | } |
| 463 | |
| 464 | void wpas_aidl_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s) |
| 465 | { |
| 466 | if (!wpa_s) |
| 467 | return; |
| 468 | |
| 469 | wpa_printf(MSG_DEBUG, "Notifying P2P find stop to aidl control"); |
| 470 | |
| 471 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 472 | if (!aidl_manager) |
| 473 | return; |
| 474 | |
| 475 | aidl_manager->notifyP2pFindStopped(wpa_s); |
| 476 | } |
| 477 | |
| 478 | void wpas_aidl_notify_p2p_go_neg_req( |
| 479 | struct wpa_supplicant *wpa_s, const u8 *src_addr, u16 dev_passwd_id, |
| 480 | u8 go_intent) |
| 481 | { |
| 482 | if (!wpa_s || !src_addr) |
| 483 | return; |
| 484 | |
| 485 | wpa_printf( |
| 486 | MSG_DEBUG, |
| 487 | "Notifying P2P GO negotiation request to aidl control " MACSTR, |
| 488 | MAC2STR(src_addr)); |
| 489 | |
| 490 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 491 | if (!aidl_manager) |
| 492 | return; |
| 493 | |
| 494 | aidl_manager->notifyP2pGoNegReq( |
| 495 | wpa_s, src_addr, dev_passwd_id, go_intent); |
| 496 | } |
| 497 | |
| 498 | void wpas_aidl_notify_p2p_go_neg_completed( |
| 499 | struct wpa_supplicant *wpa_s, const struct p2p_go_neg_results *res) |
| 500 | { |
| 501 | if (!wpa_s || !res) |
| 502 | return; |
| 503 | |
| 504 | wpa_printf( |
| 505 | MSG_DEBUG, |
| 506 | "Notifying P2P GO negotiation completed to aidl control: %d", |
| 507 | res->status); |
| 508 | |
| 509 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 510 | if (!aidl_manager) |
| 511 | return; |
| 512 | |
| 513 | aidl_manager->notifyP2pGoNegCompleted(wpa_s, res); |
| 514 | } |
| 515 | |
| 516 | void wpas_aidl_notify_p2p_group_formation_failure( |
| 517 | struct wpa_supplicant *wpa_s, const char *reason) |
| 518 | { |
| 519 | if (!wpa_s || !reason) |
| 520 | return; |
| 521 | |
| 522 | wpa_printf( |
| 523 | MSG_DEBUG, |
| 524 | "Notifying P2P Group formation failure to aidl control: %s", |
| 525 | reason); |
| 526 | |
| 527 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 528 | if (!aidl_manager) |
| 529 | return; |
| 530 | |
| 531 | aidl_manager->notifyP2pGroupFormationFailure(wpa_s, reason); |
| 532 | } |
| 533 | |
| 534 | void wpas_aidl_notify_p2p_group_started( |
| 535 | struct wpa_supplicant *wpa_s, const struct wpa_ssid *ssid, int persistent, |
Sunil Ravi | 68c25c2 | 2023-02-04 06:17:03 +0000 | [diff] [blame] | 536 | int client, const u8 *ip) |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 537 | { |
| 538 | if (!wpa_s || !ssid) |
| 539 | return; |
| 540 | |
| 541 | wpa_printf( |
| 542 | MSG_DEBUG, "Notifying P2P Group start to aidl control: %d", |
| 543 | ssid->id); |
| 544 | |
| 545 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 546 | if (!aidl_manager) |
| 547 | return; |
| 548 | |
Sunil Ravi | 68c25c2 | 2023-02-04 06:17:03 +0000 | [diff] [blame] | 549 | aidl_manager->notifyP2pGroupStarted(wpa_s, ssid, persistent, client, ip); |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 550 | } |
| 551 | |
| 552 | void wpas_aidl_notify_p2p_group_removed( |
| 553 | struct wpa_supplicant *wpa_s, const struct wpa_ssid *ssid, const char *role) |
| 554 | { |
| 555 | if (!wpa_s || !ssid || !role) |
| 556 | return; |
| 557 | |
| 558 | wpa_printf( |
| 559 | MSG_DEBUG, "Notifying P2P Group removed to aidl control: %d", |
| 560 | ssid->id); |
| 561 | |
| 562 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 563 | if (!aidl_manager) |
| 564 | return; |
| 565 | |
| 566 | aidl_manager->notifyP2pGroupRemoved(wpa_s, ssid, role); |
| 567 | } |
| 568 | |
| 569 | void wpas_aidl_notify_p2p_invitation_received( |
| 570 | struct wpa_supplicant *wpa_s, const u8 *sa, const u8 *go_dev_addr, |
| 571 | const u8 *bssid, int id, int op_freq) |
| 572 | { |
| 573 | if (!wpa_s || !sa || !go_dev_addr || !bssid) |
| 574 | return; |
| 575 | |
| 576 | wpa_printf( |
| 577 | MSG_DEBUG, |
| 578 | "Notifying P2P invitation received to aidl control: %d " MACSTR, id, |
| 579 | MAC2STR(bssid)); |
| 580 | |
| 581 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 582 | if (!aidl_manager) |
| 583 | return; |
| 584 | |
| 585 | aidl_manager->notifyP2pInvitationReceived( |
| 586 | wpa_s, sa, go_dev_addr, bssid, id, op_freq); |
| 587 | } |
| 588 | |
| 589 | void wpas_aidl_notify_p2p_invitation_result( |
| 590 | struct wpa_supplicant *wpa_s, int status, const u8 *bssid) |
| 591 | { |
| 592 | if (!wpa_s) |
| 593 | return; |
| 594 | if (bssid) { |
| 595 | wpa_printf( |
| 596 | MSG_DEBUG, |
| 597 | "Notifying P2P invitation result to aidl control: " MACSTR, |
| 598 | MAC2STR(bssid)); |
| 599 | } else { |
| 600 | wpa_printf( |
| 601 | MSG_DEBUG, |
| 602 | "Notifying P2P invitation result to aidl control: NULL " |
| 603 | "bssid"); |
| 604 | } |
| 605 | |
| 606 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 607 | if (!aidl_manager) |
| 608 | return; |
| 609 | |
| 610 | aidl_manager->notifyP2pInvitationResult(wpa_s, status, bssid); |
| 611 | } |
| 612 | |
| 613 | void wpas_aidl_notify_p2p_provision_discovery( |
| 614 | struct wpa_supplicant *wpa_s, const u8 *dev_addr, int request, |
| 615 | enum p2p_prov_disc_status status, u16 config_methods, |
| 616 | unsigned int generated_pin) |
| 617 | { |
| 618 | if (!wpa_s || !dev_addr) |
| 619 | return; |
| 620 | |
| 621 | wpa_printf( |
| 622 | MSG_DEBUG, |
| 623 | "Notifying P2P provision discovery to aidl control " MACSTR, |
| 624 | MAC2STR(dev_addr)); |
| 625 | |
| 626 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 627 | if (!aidl_manager) |
| 628 | return; |
| 629 | |
| 630 | aidl_manager->notifyP2pProvisionDiscovery( |
| 631 | wpa_s, dev_addr, request, status, config_methods, generated_pin); |
| 632 | } |
| 633 | |
| 634 | void wpas_aidl_notify_p2p_sd_response( |
| 635 | struct wpa_supplicant *wpa_s, const u8 *sa, u16 update_indic, |
| 636 | const u8 *tlvs, size_t tlvs_len) |
| 637 | { |
| 638 | if (!wpa_s || !sa || !tlvs) |
| 639 | return; |
| 640 | |
| 641 | wpa_printf( |
| 642 | MSG_DEBUG, |
| 643 | "Notifying P2P service discovery response to aidl control " MACSTR, |
| 644 | MAC2STR(sa)); |
| 645 | |
| 646 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 647 | if (!aidl_manager) |
| 648 | return; |
| 649 | |
| 650 | aidl_manager->notifyP2pSdResponse( |
| 651 | wpa_s, sa, update_indic, tlvs, tlvs_len); |
| 652 | } |
| 653 | |
| 654 | void wpas_aidl_notify_ap_sta_authorized( |
| 655 | struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr) |
| 656 | { |
| 657 | if (!wpa_s || !sta) |
| 658 | return; |
| 659 | |
| 660 | wpa_printf( |
| 661 | MSG_DEBUG, |
| 662 | "Notifying P2P AP STA authorized to aidl control " MACSTR, |
| 663 | MAC2STR(sta)); |
| 664 | |
| 665 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 666 | if (!aidl_manager) |
| 667 | return; |
| 668 | |
| 669 | aidl_manager->notifyApStaAuthorized(wpa_s, sta, p2p_dev_addr); |
| 670 | } |
| 671 | |
| 672 | void wpas_aidl_notify_ap_sta_deauthorized( |
| 673 | struct wpa_supplicant *wpa_s, const u8 *sta, const u8 *p2p_dev_addr) |
| 674 | { |
| 675 | if (!wpa_s || !sta) |
| 676 | return; |
| 677 | |
| 678 | wpa_printf( |
| 679 | MSG_DEBUG, |
| 680 | "Notifying P2P AP STA deauthorized to aidl control " MACSTR, |
| 681 | MAC2STR(sta)); |
| 682 | |
| 683 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 684 | if (!aidl_manager) |
| 685 | return; |
| 686 | |
| 687 | aidl_manager->notifyApStaDeauthorized(wpa_s, sta, p2p_dev_addr); |
| 688 | } |
| 689 | |
| 690 | void wpas_aidl_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code) |
| 691 | { |
| 692 | if (!wpa_s) |
| 693 | return; |
| 694 | |
| 695 | wpa_printf(MSG_DEBUG, "Notifying EAP Error: %d ", error_code); |
| 696 | |
| 697 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 698 | if (!aidl_manager) |
| 699 | return; |
| 700 | |
| 701 | aidl_manager->notifyEapError(wpa_s, error_code); |
| 702 | } |
| 703 | |
| 704 | void wpas_aidl_notify_dpp_config_received(struct wpa_supplicant *wpa_s, |
Sunil Ravi | 546a7b5 | 2022-08-26 22:06:04 +0000 | [diff] [blame] | 705 | struct wpa_ssid *ssid, bool conn_status_requested) |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 706 | { |
| 707 | if (!wpa_s || !ssid) |
| 708 | return; |
| 709 | |
| 710 | wpa_printf( |
| 711 | MSG_DEBUG, |
| 712 | "Notifying DPP configuration received for SSID %d", ssid->id); |
| 713 | |
| 714 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 715 | if (!aidl_manager) |
| 716 | return; |
| 717 | |
Sunil Ravi | 546a7b5 | 2022-08-26 22:06:04 +0000 | [diff] [blame] | 718 | aidl_manager->notifyDppConfigReceived(wpa_s, ssid, conn_status_requested); |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 719 | } |
| 720 | |
| 721 | void wpas_aidl_notify_dpp_config_sent(struct wpa_supplicant *wpa_s) |
| 722 | { |
| 723 | wpas_aidl_notify_dpp_success(wpa_s, DppEventType::CONFIGURATION_SENT); |
| 724 | } |
| 725 | |
Sunil Ravi | 546a7b5 | 2022-08-26 22:06:04 +0000 | [diff] [blame] | 726 | void wpas_aidl_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s, |
| 727 | enum dpp_status_error result) |
| 728 | { |
| 729 | if (!wpa_s) |
| 730 | return; |
| 731 | |
| 732 | wpa_printf(MSG_DEBUG, "wpas_aidl_notify_dpp_connection_status_sent %d ", result); |
| 733 | |
| 734 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 735 | if (!aidl_manager) |
| 736 | return; |
| 737 | |
| 738 | aidl_manager->notifyDppConnectionStatusSent(wpa_s, result); |
| 739 | } |
| 740 | |
Gabriel Biren | 57ededa | 2021-09-03 16:08:50 +0000 | [diff] [blame] | 741 | /* DPP Progress notifications */ |
| 742 | void wpas_aidl_notify_dpp_auth_success(struct wpa_supplicant *wpa_s) |
| 743 | { |
| 744 | wpas_aidl_notify_dpp_progress(wpa_s, DppProgressCode::AUTHENTICATION_SUCCESS); |
| 745 | } |
| 746 | |
| 747 | void wpas_aidl_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s) |
| 748 | { |
| 749 | wpas_aidl_notify_dpp_progress(wpa_s, DppProgressCode::RESPONSE_PENDING); |
| 750 | } |
| 751 | |
| 752 | /* DPP Failure notifications */ |
| 753 | void wpas_aidl_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s) |
| 754 | { |
| 755 | wpas_aidl_notify_dpp_failure(wpa_s, DppFailureCode::NOT_COMPATIBLE); |
| 756 | } |
| 757 | |
| 758 | void wpas_aidl_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s) |
| 759 | { |
| 760 | wpas_aidl_notify_dpp_failure(wpa_s, DppFailureCode::AUTHENTICATION); |
| 761 | } |
| 762 | |
| 763 | void wpas_aidl_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s) |
| 764 | { |
| 765 | wpas_aidl_notify_dpp_failure(wpa_s, DppFailureCode::CONFIGURATION); |
| 766 | } |
| 767 | |
| 768 | void wpas_aidl_notify_dpp_timeout(struct wpa_supplicant *wpa_s) |
| 769 | { |
| 770 | wpas_aidl_notify_dpp_failure(wpa_s, DppFailureCode::TIMEOUT); |
| 771 | } |
| 772 | |
| 773 | void wpas_aidl_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s) |
| 774 | { |
| 775 | wpas_aidl_notify_dpp_failure(wpa_s, DppFailureCode::AUTHENTICATION); |
| 776 | } |
| 777 | |
| 778 | void wpas_aidl_notify_dpp_fail(struct wpa_supplicant *wpa_s) |
| 779 | { |
| 780 | wpas_aidl_notify_dpp_failure(wpa_s, DppFailureCode::FAILURE); |
| 781 | } |
| 782 | |
| 783 | void wpas_aidl_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s) |
| 784 | { |
| 785 | wpas_aidl_notify_dpp_progress(wpa_s, DppProgressCode::CONFIGURATION_SENT_WAITING_RESPONSE); |
| 786 | } |
| 787 | |
| 788 | /* DPP notification helper functions */ |
| 789 | static void wpas_aidl_notify_dpp_failure(struct wpa_supplicant *wpa_s, DppFailureCode code) |
| 790 | { |
| 791 | if (!wpa_s) |
| 792 | return; |
| 793 | |
| 794 | wpa_printf( |
| 795 | MSG_DEBUG, |
| 796 | "Notifying DPP failure event %d", code); |
| 797 | |
| 798 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 799 | if (!aidl_manager) |
| 800 | return; |
| 801 | |
| 802 | aidl_manager->notifyDppFailure(wpa_s, code); |
| 803 | } |
| 804 | |
| 805 | static void wpas_aidl_notify_dpp_progress(struct wpa_supplicant *wpa_s, DppProgressCode code) |
| 806 | { |
| 807 | if (!wpa_s) |
| 808 | return; |
| 809 | |
| 810 | wpa_printf( |
| 811 | MSG_DEBUG, |
| 812 | "Notifying DPP progress event %d", code); |
| 813 | |
| 814 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 815 | if (!aidl_manager) |
| 816 | return; |
| 817 | |
| 818 | aidl_manager->notifyDppProgress(wpa_s, code); |
| 819 | } |
| 820 | |
| 821 | void wpas_aidl_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s) |
| 822 | { |
| 823 | wpas_aidl_notify_dpp_progress(wpa_s, DppProgressCode::CONFIGURATION_ACCEPTED); |
| 824 | } |
| 825 | |
| 826 | static void wpas_aidl_notify_dpp_config_applied(struct wpa_supplicant *wpa_s) |
| 827 | { |
| 828 | wpas_aidl_notify_dpp_success(wpa_s, DppEventType::CONFIGURATION_APPLIED); |
| 829 | } |
| 830 | |
| 831 | static void wpas_aidl_notify_dpp_success(struct wpa_supplicant *wpa_s, DppEventType code) |
| 832 | { |
| 833 | if (!wpa_s) |
| 834 | return; |
| 835 | |
| 836 | wpa_printf( |
| 837 | MSG_DEBUG, |
| 838 | "Notifying DPP progress event %d", code); |
| 839 | |
| 840 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 841 | if (!aidl_manager) |
| 842 | return; |
| 843 | |
| 844 | aidl_manager->notifyDppSuccess(wpa_s, code); |
| 845 | } |
| 846 | |
| 847 | void wpas_aidl_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s) |
| 848 | { |
| 849 | wpas_aidl_notify_dpp_failure(wpa_s, DppFailureCode::CONFIGURATION_REJECTED); |
| 850 | } |
| 851 | |
| 852 | static void wpas_aidl_notify_dpp_no_ap_failure(struct wpa_supplicant *wpa_s, |
| 853 | const char *ssid, const char *channel_list, unsigned short band_list[], |
| 854 | int size) |
| 855 | { |
| 856 | if (!wpa_s) |
| 857 | return; |
| 858 | |
| 859 | wpa_printf(MSG_DEBUG, |
| 860 | "Notifying DPP NO AP event for SSID %s\nTried channels: %s", |
| 861 | ssid ? ssid : "N/A", channel_list ? channel_list : "N/A"); |
| 862 | |
| 863 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 864 | if (!aidl_manager) |
| 865 | return; |
| 866 | |
| 867 | aidl_manager->notifyDppFailure(wpa_s, DppFailureCode::CANNOT_FIND_NETWORK, |
| 868 | ssid, channel_list, band_list, size); |
| 869 | } |
| 870 | |
| 871 | void wpas_aidl_notify_dpp_enrollee_auth_failure(struct wpa_supplicant *wpa_s, |
| 872 | const char *ssid, unsigned short band_list[], int size) |
| 873 | { |
| 874 | if (!wpa_s) |
| 875 | return; |
| 876 | |
| 877 | wpa_printf(MSG_DEBUG, |
| 878 | "Notifying DPP Enrollee authentication failure, SSID %s", |
| 879 | ssid ? ssid : "N/A"); |
| 880 | |
| 881 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 882 | if (!aidl_manager) |
| 883 | return; |
| 884 | |
| 885 | aidl_manager->notifyDppFailure(wpa_s, DppFailureCode::ENROLLEE_AUTHENTICATION, |
| 886 | ssid, NULL, band_list, size); |
| 887 | } |
| 888 | |
| 889 | |
| 890 | void wpas_aidl_notify_dpp_conn_status(struct wpa_supplicant *wpa_s, enum dpp_status_error status, |
| 891 | const char *ssid, const char *channel_list, unsigned short band_list[], int size) |
| 892 | { |
| 893 | switch (status) |
| 894 | { |
| 895 | case DPP_STATUS_OK: |
| 896 | wpas_aidl_notify_dpp_config_applied(wpa_s); |
| 897 | break; |
| 898 | |
| 899 | case DPP_STATUS_NO_AP: |
| 900 | wpas_aidl_notify_dpp_no_ap_failure(wpa_s, ssid, channel_list, band_list, size); |
| 901 | break; |
| 902 | |
| 903 | case DPP_STATUS_AUTH_FAILURE: |
| 904 | wpas_aidl_notify_dpp_enrollee_auth_failure(wpa_s, ssid, band_list, size); |
| 905 | break; |
| 906 | |
| 907 | default: |
| 908 | break; |
| 909 | } |
| 910 | } |
| 911 | |
| 912 | void wpas_aidl_notify_pmk_cache_added( |
| 913 | struct wpa_supplicant *wpa_s, |
| 914 | struct rsn_pmksa_cache_entry *pmksa_entry) |
| 915 | { |
| 916 | if (!wpa_s || !pmksa_entry) |
| 917 | return; |
| 918 | |
| 919 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 920 | if (!aidl_manager) |
| 921 | return; |
| 922 | |
| 923 | wpa_printf( |
| 924 | MSG_DEBUG, |
| 925 | "Notifying PMK cache added event"); |
| 926 | |
| 927 | aidl_manager->notifyPmkCacheAdded(wpa_s, pmksa_entry); |
| 928 | } |
| 929 | |
| 930 | void wpas_aidl_notify_bss_tm_status(struct wpa_supplicant *wpa_s) |
| 931 | { |
| 932 | if (!wpa_s) |
| 933 | return; |
| 934 | |
| 935 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 936 | if (!aidl_manager) |
| 937 | return; |
| 938 | |
| 939 | wpa_printf(MSG_DEBUG, "Notifying BSS transition status"); |
| 940 | |
| 941 | aidl_manager->notifyBssTmStatus(wpa_s); |
| 942 | } |
| 943 | |
| 944 | void wpas_aidl_notify_transition_disable(struct wpa_supplicant *wpa_s, |
| 945 | struct wpa_ssid *ssid, |
| 946 | u8 bitmap) |
| 947 | { |
| 948 | if (!wpa_s || !ssid) |
| 949 | return; |
| 950 | |
| 951 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 952 | if (!aidl_manager) |
| 953 | return; |
| 954 | |
| 955 | aidl_manager->notifyTransitionDisable(wpa_s, ssid, bitmap); |
| 956 | } |
| 957 | |
| 958 | void wpas_aidl_notify_network_not_found(struct wpa_supplicant *wpa_s) |
| 959 | { |
| 960 | if (!wpa_s) |
| 961 | return; |
| 962 | |
| 963 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 964 | if (!aidl_manager) |
| 965 | return; |
| 966 | |
| 967 | wpa_printf(MSG_DEBUG, "Notify network not found"); |
| 968 | |
| 969 | aidl_manager->notifyNetworkNotFound(wpa_s); |
| 970 | } |
Sunil Ravi | 23087aa | 2021-12-08 19:01:44 -0800 | [diff] [blame] | 971 | |
Sunil Ravi | 65a724b | 2022-05-24 11:06:09 -0700 | [diff] [blame] | 972 | void wpas_aidl_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency) |
Sunil Ravi | 23087aa | 2021-12-08 19:01:44 -0800 | [diff] [blame] | 973 | { |
| 974 | if (!wpa_s) |
| 975 | return; |
| 976 | |
| 977 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 978 | if (!aidl_manager) |
| 979 | return; |
| 980 | |
Sunil Ravi | 65a724b | 2022-05-24 11:06:09 -0700 | [diff] [blame] | 981 | wpa_printf(MSG_INFO, "Notify %s frequency changed to %d", |
| 982 | wpa_s->ifname, frequency); |
Sunil Ravi | 23087aa | 2021-12-08 19:01:44 -0800 | [diff] [blame] | 983 | |
Sunil Ravi | 65a724b | 2022-05-24 11:06:09 -0700 | [diff] [blame] | 984 | aidl_manager->notifyFrequencyChanged(wpa_s, frequency); |
Sunil Ravi | 23087aa | 2021-12-08 19:01:44 -0800 | [diff] [blame] | 985 | } |
Jimmy Chen | 429daf9 | 2021-10-20 13:27:23 +0800 | [diff] [blame] | 986 | |
| 987 | void wpas_aidl_notify_ceritification(struct wpa_supplicant *wpa_s, |
| 988 | int depth, const char *subject, |
| 989 | const char *altsubject[], |
| 990 | int num_altsubject, |
| 991 | const char *cert_hash, |
| 992 | const struct wpabuf *cert) |
| 993 | { |
| 994 | if (!wpa_s) |
| 995 | return; |
| 996 | |
| 997 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 998 | if (!aidl_manager) |
| 999 | return; |
| 1000 | |
| 1001 | wpa_printf(MSG_DEBUG, "Notify certification"); |
| 1002 | |
| 1003 | aidl_manager->notifyCertification(wpa_s, |
| 1004 | depth, |
| 1005 | subject, |
| 1006 | altsubject, |
| 1007 | num_altsubject, |
| 1008 | cert_hash, |
| 1009 | cert); |
| 1010 | } |
Gabriel Biren | 3a2ec2c | 2022-03-07 17:59:41 +0000 | [diff] [blame] | 1011 | |
| 1012 | void wpas_aidl_notify_auxiliary_event(struct wpa_supplicant *wpa_s, |
| 1013 | AuxiliarySupplicantEventCode event_code, const char *reason_string) |
| 1014 | { |
| 1015 | if (!wpa_s) |
| 1016 | return; |
| 1017 | |
| 1018 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 1019 | if (!aidl_manager) |
| 1020 | return; |
| 1021 | |
| 1022 | wpa_printf(MSG_DEBUG, "Notify auxiliary event, code=%d", |
| 1023 | static_cast<int>(event_code)); |
| 1024 | aidl_manager->notifyAuxiliaryEvent(wpa_s, event_code, reason_string); |
| 1025 | } |
| 1026 | |
| 1027 | void wpas_aidl_notify_eap_method_selected(struct wpa_supplicant *wpa_s, |
| 1028 | const char *reason_string) |
| 1029 | { |
| 1030 | wpas_aidl_notify_auxiliary_event(wpa_s, |
| 1031 | AuxiliarySupplicantEventCode::EAP_METHOD_SELECTED, |
| 1032 | reason_string); |
| 1033 | } |
| 1034 | |
| 1035 | void wpas_aidl_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s, |
| 1036 | const char *reason_string) |
| 1037 | { |
| 1038 | wpas_aidl_notify_auxiliary_event(wpa_s, |
| 1039 | AuxiliarySupplicantEventCode::SSID_TEMP_DISABLED, |
| 1040 | reason_string); |
| 1041 | } |
| 1042 | |
| 1043 | void wpas_aidl_notify_open_ssl_failure(struct wpa_supplicant *wpa_s, |
| 1044 | const char *reason_string) |
| 1045 | { |
| 1046 | wpas_aidl_notify_auxiliary_event(wpa_s, |
| 1047 | AuxiliarySupplicantEventCode::OPEN_SSL_FAILURE, |
| 1048 | reason_string); |
| 1049 | } |
Shivani Baranwal | 84940f8 | 2022-02-02 10:21:47 +0530 | [diff] [blame] | 1050 | |
| 1051 | void wpas_aidl_notify_qos_policy_reset( |
| 1052 | struct wpa_supplicant *wpa_s) |
| 1053 | { |
| 1054 | if (!wpa_s) |
| 1055 | return; |
| 1056 | wpa_printf( |
| 1057 | MSG_DEBUG, "Notifying Qos Policy Reset"); |
| 1058 | |
| 1059 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 1060 | if (!aidl_manager) |
| 1061 | return; |
| 1062 | |
| 1063 | aidl_manager->notifyQosPolicyReset(wpa_s); |
| 1064 | } |
| 1065 | |
| 1066 | void wpas_aidl_notify_qos_policy_request(struct wpa_supplicant *wpa_s, |
| 1067 | struct dscp_policy_data *policies, int num_policies) |
| 1068 | { |
| 1069 | if (!wpa_s || !policies) |
| 1070 | return; |
| 1071 | |
| 1072 | wpa_printf( |
| 1073 | MSG_DEBUG, "Notifying Qos Policy Request"); |
| 1074 | |
| 1075 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 1076 | if (!aidl_manager) |
| 1077 | return; |
| 1078 | |
| 1079 | aidl_manager->notifyQosPolicyRequest(wpa_s, policies, num_policies); |
| 1080 | } |
| 1081 | |
Gabriel Biren | 9339823 | 2022-12-15 19:18:28 +0000 | [diff] [blame] | 1082 | ssize_t wpas_aidl_get_certificate(const char* alias, uint8_t** value) |
| 1083 | { |
| 1084 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 1085 | if (!aidl_manager) |
| 1086 | return -1; |
| 1087 | |
Gabriel Biren | 980c48a | 2023-03-27 21:49:21 +0000 | [diff] [blame] | 1088 | wpa_printf(MSG_INFO, "Requesting certificate from framework"); |
| 1089 | |
Gabriel Biren | 9339823 | 2022-12-15 19:18:28 +0000 | [diff] [blame] | 1090 | return aidl_manager->getCertificate(alias, value); |
| 1091 | } |
Swarn Singh | c450e7b | 2023-03-28 17:36:22 +0530 | [diff] [blame] | 1092 | |
Xinyue Ling | 1629ad8 | 2023-03-24 16:19:51 +0800 | [diff] [blame] | 1093 | ssize_t wpas_aidl_list_aliases(const char *prefix, char ***aliases) |
| 1094 | { |
| 1095 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 1096 | if (!aidl_manager) |
| 1097 | return -1; |
| 1098 | |
| 1099 | wpa_printf(MSG_INFO, "Requesting aliases from framework"); |
| 1100 | |
| 1101 | return aidl_manager->listAliases(prefix, aliases); |
| 1102 | } |
| 1103 | |
Swarn Singh | c450e7b | 2023-03-28 17:36:22 +0530 | [diff] [blame] | 1104 | void wpas_aidl_notify_qos_policy_scs_response(struct wpa_supplicant *wpa_s, |
| 1105 | unsigned int count, int **scs_resp) |
| 1106 | { |
| 1107 | if (!wpa_s || !count || !scs_resp) |
| 1108 | return; |
| 1109 | |
| 1110 | AidlManager *aidl_manager = AidlManager::getInstance(); |
| 1111 | if (!aidl_manager) |
| 1112 | return; |
| 1113 | |
| 1114 | wpa_printf(MSG_DEBUG, "Notifying Qos Policy SCS Response"); |
| 1115 | aidl_manager->notifyQosPolicyScsResponse(wpa_s, count, scs_resp); |
| 1116 | } |