1 /* 2 * wpa_supplicant - Internal driver interface wrappers 3 * Copyright (c) 2003-2009, Jouni Malinen <j (at) 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 #ifndef DRIVER_I_H 10 #define DRIVER_I_H 11 12 #include "drivers/driver.h" 13 14 /* driver_ops */ 15 static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s, 16 const char *ifname) 17 { 18 if (wpa_s->driver->init2) 19 return wpa_s->driver->init2(wpa_s, ifname, 20 wpa_s->global_drv_priv); 21 if (wpa_s->driver->init) { 22 return wpa_s->driver->init(wpa_s, ifname); 23 } 24 return NULL; 25 } 26 27 static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s) 28 { 29 if (wpa_s->driver->deinit) 30 wpa_s->driver->deinit(wpa_s->drv_priv); 31 } 32 33 static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s, 34 const char *param) 35 { 36 if (wpa_s->driver->set_param) 37 return wpa_s->driver->set_param(wpa_s->drv_priv, param); 38 return 0; 39 } 40 41 static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s, 42 int enabled) 43 { 44 if (wpa_s->driver->set_countermeasures) { 45 return wpa_s->driver->set_countermeasures(wpa_s->drv_priv, 46 enabled); 47 } 48 return -1; 49 } 50 51 static inline int wpa_drv_authenticate(struct wpa_supplicant *wpa_s, 52 struct wpa_driver_auth_params *params) 53 { 54 if (wpa_s->driver->authenticate) 55 return wpa_s->driver->authenticate(wpa_s->drv_priv, params); 56 return -1; 57 } 58 59 static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s, 60 struct wpa_driver_associate_params *params) 61 { 62 if (wpa_s->driver->associate) { 63 return wpa_s->driver->associate(wpa_s->drv_priv, params); 64 } 65 return -1; 66 } 67 68 static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s, 69 struct wpa_driver_scan_params *params) 70 { 71 if (wpa_s->driver->scan2) 72 return wpa_s->driver->scan2(wpa_s->drv_priv, params); 73 return -1; 74 } 75 76 static inline int wpa_drv_sched_scan(struct wpa_supplicant *wpa_s, 77 struct wpa_driver_scan_params *params, 78 u32 interval) 79 { 80 if (wpa_s->driver->sched_scan) 81 return wpa_s->driver->sched_scan(wpa_s->drv_priv, 82 params, interval); 83 return -1; 84 } 85 86 static inline int wpa_drv_stop_sched_scan(struct wpa_supplicant *wpa_s) 87 { 88 if (wpa_s->driver->stop_sched_scan) 89 return wpa_s->driver->stop_sched_scan(wpa_s->drv_priv); 90 return -1; 91 } 92 93 static inline struct wpa_scan_results * wpa_drv_get_scan_results2( 94 struct wpa_supplicant *wpa_s) 95 { 96 if (wpa_s->driver->get_scan_results2) 97 return wpa_s->driver->get_scan_results2(wpa_s->drv_priv); 98 return NULL; 99 } 100 101 static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid) 102 { 103 if (wpa_s->driver->get_bssid) { 104 return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid); 105 } 106 return -1; 107 } 108 109 static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid) 110 { 111 if (wpa_s->driver->get_ssid) { 112 return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid); 113 } 114 return -1; 115 } 116 117 static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s, 118 enum wpa_alg alg, const u8 *addr, 119 int key_idx, int set_tx, 120 const u8 *seq, size_t seq_len, 121 const u8 *key, size_t key_len) 122 { 123 if (alg != WPA_ALG_NONE) { 124 if (key_idx >= 0 && key_idx <= 6) 125 wpa_s->keys_cleared &= ~BIT(key_idx); 126 else 127 wpa_s->keys_cleared = 0; 128 } 129 if (wpa_s->driver->set_key) { 130 return wpa_s->driver->set_key(wpa_s->ifname, wpa_s->drv_priv, 131 alg, addr, key_idx, set_tx, 132 seq, seq_len, key, key_len); 133 } 134 return -1; 135 } 136 137 static inline int wpa_drv_sta_deauth(struct wpa_supplicant *wpa_s, 138 const u8 *addr, int reason_code) 139 { 140 if (wpa_s->driver->sta_deauth) { 141 return wpa_s->driver->sta_deauth(wpa_s->drv_priv, 142 wpa_s->own_addr, addr, 143 reason_code); 144 } 145 return -1; 146 } 147 148 static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s, 149 const u8 *addr, int reason_code) 150 { 151 if (wpa_s->driver->deauthenticate) { 152 return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr, 153 reason_code); 154 } 155 return -1; 156 } 157 158 static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s, 159 const u8 *bssid, const u8 *pmkid) 160 { 161 if (wpa_s->driver->add_pmkid) { 162 return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid); 163 } 164 return -1; 165 } 166 167 static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s, 168 const u8 *bssid, const u8 *pmkid) 169 { 170 if (wpa_s->driver->remove_pmkid) { 171 return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid, 172 pmkid); 173 } 174 return -1; 175 } 176 177 static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s) 178 { 179 if (wpa_s->driver->flush_pmkid) { 180 return wpa_s->driver->flush_pmkid(wpa_s->drv_priv); 181 } 182 return -1; 183 } 184 185 static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s, 186 struct wpa_driver_capa *capa) 187 { 188 if (wpa_s->driver->get_capa) { 189 return wpa_s->driver->get_capa(wpa_s->drv_priv, capa); 190 } 191 return -1; 192 } 193 194 static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s) 195 { 196 if (wpa_s->driver->poll) { 197 wpa_s->driver->poll(wpa_s->drv_priv); 198 } 199 } 200 201 static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s) 202 { 203 if (wpa_s->driver->get_ifname) { 204 return wpa_s->driver->get_ifname(wpa_s->drv_priv); 205 } 206 return NULL; 207 } 208 209 static inline const char * 210 wpa_driver_get_radio_name(struct wpa_supplicant *wpa_s) 211 { 212 if (wpa_s->driver->get_radio_name) 213 return wpa_s->driver->get_radio_name(wpa_s->drv_priv); 214 return NULL; 215 } 216 217 static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s) 218 { 219 if (wpa_s->driver->get_mac_addr) { 220 return wpa_s->driver->get_mac_addr(wpa_s->drv_priv); 221 } 222 return NULL; 223 } 224 225 static inline int wpa_drv_send_eapol(struct wpa_supplicant *wpa_s, 226 const u8 *dst, u16 proto, 227 const u8 *data, size_t data_len) 228 { 229 if (wpa_s->driver->send_eapol) 230 return wpa_s->driver->send_eapol(wpa_s->drv_priv, dst, proto, 231 data, data_len); 232 return -1; 233 } 234 235 static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s, 236 int state) 237 { 238 if (wpa_s->driver->set_operstate) 239 return wpa_s->driver->set_operstate(wpa_s->drv_priv, state); 240 return 0; 241 } 242 243 static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s, 244 const u8 *addr, int protect_type, 245 int key_type) 246 { 247 if (wpa_s->driver->mlme_setprotection) 248 return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr, 249 protect_type, 250 key_type); 251 return 0; 252 } 253 254 static inline struct hostapd_hw_modes * 255 wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes, 256 u16 *flags) 257 { 258 if (wpa_s->driver->get_hw_feature_data) 259 return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv, 260 num_modes, flags); 261 return NULL; 262 } 263 264 static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s, 265 const char *alpha2) 266 { 267 if (wpa_s->driver->set_country) 268 return wpa_s->driver->set_country(wpa_s->drv_priv, alpha2); 269 return 0; 270 } 271 272 static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s, 273 const u8 *data, size_t data_len, int noack) 274 { 275 if (wpa_s->driver->send_mlme) 276 return wpa_s->driver->send_mlme(wpa_s->drv_priv, 277 data, data_len, noack); 278 return -1; 279 } 280 281 static inline int wpa_drv_update_ft_ies(struct wpa_supplicant *wpa_s, 282 const u8 *md, 283 const u8 *ies, size_t ies_len) 284 { 285 if (wpa_s->driver->update_ft_ies) 286 return wpa_s->driver->update_ft_ies(wpa_s->drv_priv, md, 287 ies, ies_len); 288 return -1; 289 } 290 291 static inline int wpa_drv_send_ft_action(struct wpa_supplicant *wpa_s, 292 u8 action, const u8 *target_ap, 293 const u8 *ies, size_t ies_len) 294 { 295 if (wpa_s->driver->send_ft_action) 296 return wpa_s->driver->send_ft_action(wpa_s->drv_priv, action, 297 target_ap, ies, ies_len); 298 return -1; 299 } 300 301 static inline int wpa_drv_set_ap(struct wpa_supplicant *wpa_s, 302 struct wpa_driver_ap_params *params) 303 { 304 if (wpa_s->driver->set_ap) 305 return wpa_s->driver->set_ap(wpa_s->drv_priv, params); 306 return -1; 307 } 308 309 static inline int wpa_drv_sta_add(struct wpa_supplicant *wpa_s, 310 struct hostapd_sta_add_params *params) 311 { 312 if (wpa_s->driver->sta_add) 313 return wpa_s->driver->sta_add(wpa_s->drv_priv, params); 314 return -1; 315 } 316 317 static inline int wpa_drv_sta_remove(struct wpa_supplicant *wpa_s, 318 const u8 *addr) 319 { 320 if (wpa_s->driver->sta_remove) 321 return wpa_s->driver->sta_remove(wpa_s->drv_priv, addr); 322 return -1; 323 } 324 325 static inline int wpa_drv_hapd_send_eapol(struct wpa_supplicant *wpa_s, 326 const u8 *addr, const u8 *data, 327 size_t data_len, int encrypt, 328 const u8 *own_addr, u32 flags) 329 { 330 if (wpa_s->driver->hapd_send_eapol) 331 return wpa_s->driver->hapd_send_eapol(wpa_s->drv_priv, addr, 332 data, data_len, encrypt, 333 own_addr, flags); 334 return -1; 335 } 336 337 static inline int wpa_drv_sta_set_flags(struct wpa_supplicant *wpa_s, 338 const u8 *addr, int total_flags, 339 int flags_or, int flags_and) 340 { 341 if (wpa_s->driver->sta_set_flags) 342 return wpa_s->driver->sta_set_flags(wpa_s->drv_priv, addr, 343 total_flags, flags_or, 344 flags_and); 345 return -1; 346 } 347 348 static inline int wpa_drv_set_supp_port(struct wpa_supplicant *wpa_s, 349 int authorized) 350 { 351 if (wpa_s->driver->set_supp_port) { 352 return wpa_s->driver->set_supp_port(wpa_s->drv_priv, 353 authorized); 354 } 355 return 0; 356 } 357 358 static inline int wpa_drv_send_action(struct wpa_supplicant *wpa_s, 359 unsigned int freq, 360 unsigned int wait, 361 const u8 *dst, const u8 *src, 362 const u8 *bssid, 363 const u8 *data, size_t data_len, 364 int no_cck) 365 { 366 if (wpa_s->driver->send_action) 367 return wpa_s->driver->send_action(wpa_s->drv_priv, freq, 368 wait, dst, src, bssid, 369 data, data_len, no_cck); 370 return -1; 371 } 372 373 static inline void wpa_drv_send_action_cancel_wait(struct wpa_supplicant *wpa_s) 374 { 375 if (wpa_s->driver->send_action_cancel_wait) 376 wpa_s->driver->send_action_cancel_wait(wpa_s->drv_priv); 377 } 378 379 static inline int wpa_drv_set_freq(struct wpa_supplicant *wpa_s, 380 struct hostapd_freq_params *freq) 381 { 382 if (wpa_s->driver->set_freq) 383 return wpa_s->driver->set_freq(wpa_s->drv_priv, freq); 384 return -1; 385 } 386 387 static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s, 388 enum wpa_driver_if_type type, 389 const char *ifname, const u8 *addr, 390 void *bss_ctx, char *force_ifname, 391 u8 *if_addr, const char *bridge) 392 { 393 if (wpa_s->driver->if_add) 394 return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname, 395 addr, bss_ctx, NULL, force_ifname, 396 if_addr, bridge, 0); 397 return -1; 398 } 399 400 static inline int wpa_drv_if_remove(struct wpa_supplicant *wpa_s, 401 enum wpa_driver_if_type type, 402 const char *ifname) 403 { 404 if (wpa_s->driver->if_remove) 405 return wpa_s->driver->if_remove(wpa_s->drv_priv, type, ifname); 406 return -1; 407 } 408 409 static inline int wpa_drv_remain_on_channel(struct wpa_supplicant *wpa_s, 410 unsigned int freq, 411 unsigned int duration) 412 { 413 if (wpa_s->driver->remain_on_channel) 414 return wpa_s->driver->remain_on_channel(wpa_s->drv_priv, freq, 415 duration); 416 return -1; 417 } 418 419 static inline int wpa_drv_cancel_remain_on_channel( 420 struct wpa_supplicant *wpa_s) 421 { 422 if (wpa_s->driver->cancel_remain_on_channel) 423 return wpa_s->driver->cancel_remain_on_channel( 424 wpa_s->drv_priv); 425 return -1; 426 } 427 428 static inline int wpa_drv_probe_req_report(struct wpa_supplicant *wpa_s, 429 int report) 430 { 431 if (wpa_s->driver->probe_req_report) 432 return wpa_s->driver->probe_req_report(wpa_s->drv_priv, 433 report); 434 return -1; 435 } 436 437 static inline int wpa_drv_deinit_ap(struct wpa_supplicant *wpa_s) 438 { 439 if (wpa_s->driver->deinit_ap) 440 return wpa_s->driver->deinit_ap(wpa_s->drv_priv); 441 return 0; 442 } 443 444 static inline int wpa_drv_deinit_p2p_cli(struct wpa_supplicant *wpa_s) 445 { 446 if (wpa_s->driver->deinit_p2p_cli) 447 return wpa_s->driver->deinit_p2p_cli(wpa_s->drv_priv); 448 return 0; 449 } 450 451 static inline void wpa_drv_suspend(struct wpa_supplicant *wpa_s) 452 { 453 if (wpa_s->driver->suspend) 454 wpa_s->driver->suspend(wpa_s->drv_priv); 455 } 456 457 static inline void wpa_drv_resume(struct wpa_supplicant *wpa_s) 458 { 459 if (wpa_s->driver->resume) 460 wpa_s->driver->resume(wpa_s->drv_priv); 461 } 462 463 static inline int wpa_drv_signal_monitor(struct wpa_supplicant *wpa_s, 464 int threshold, int hysteresis) 465 { 466 if (wpa_s->driver->signal_monitor) 467 return wpa_s->driver->signal_monitor(wpa_s->drv_priv, 468 threshold, hysteresis); 469 return -1; 470 } 471 472 static inline int wpa_drv_signal_poll(struct wpa_supplicant *wpa_s, 473 struct wpa_signal_info *si) 474 { 475 if (wpa_s->driver->signal_poll) 476 return wpa_s->driver->signal_poll(wpa_s->drv_priv, si); 477 return -1; 478 } 479 480 static inline int wpa_drv_pktcnt_poll(struct wpa_supplicant *wpa_s, 481 struct hostap_sta_driver_data *sta) 482 { 483 if (wpa_s->driver->read_sta_data) 484 return wpa_s->driver->read_sta_data(wpa_s->drv_priv, sta, 485 wpa_s->bssid); 486 return -1; 487 } 488 489 static inline int wpa_drv_set_ap_wps_ie(struct wpa_supplicant *wpa_s, 490 const struct wpabuf *beacon, 491 const struct wpabuf *proberesp, 492 const struct wpabuf *assocresp) 493 { 494 if (!wpa_s->driver->set_ap_wps_ie) 495 return -1; 496 return wpa_s->driver->set_ap_wps_ie(wpa_s->drv_priv, beacon, 497 proberesp, assocresp); 498 } 499 500 static inline int wpa_drv_shared_freq(struct wpa_supplicant *wpa_s) 501 { 502 if (!wpa_s->driver->shared_freq) 503 return -1; 504 return wpa_s->driver->shared_freq(wpa_s->drv_priv); 505 } 506 507 static inline int wpa_drv_get_noa(struct wpa_supplicant *wpa_s, 508 u8 *buf, size_t buf_len) 509 { 510 if (!wpa_s->driver->get_noa) 511 return -1; 512 return wpa_s->driver->get_noa(wpa_s->drv_priv, buf, buf_len); 513 } 514 515 static inline int wpa_drv_set_p2p_powersave(struct wpa_supplicant *wpa_s, 516 int legacy_ps, int opp_ps, 517 int ctwindow) 518 { 519 if (!wpa_s->driver->set_p2p_powersave) 520 return -1; 521 return wpa_s->driver->set_p2p_powersave(wpa_s->drv_priv, legacy_ps, 522 opp_ps, ctwindow); 523 } 524 525 static inline int wpa_drv_ampdu(struct wpa_supplicant *wpa_s, int ampdu) 526 { 527 if (!wpa_s->driver->ampdu) 528 return -1; 529 return wpa_s->driver->ampdu(wpa_s->drv_priv, ampdu); 530 } 531 532 static inline int wpa_drv_send_tdls_mgmt(struct wpa_supplicant *wpa_s, 533 const u8 *dst, u8 action_code, 534 u8 dialog_token, u16 status_code, 535 u32 peer_capab, const u8 *buf, 536 size_t len) 537 { 538 if (wpa_s->driver->send_tdls_mgmt) { 539 return wpa_s->driver->send_tdls_mgmt(wpa_s->drv_priv, dst, 540 action_code, dialog_token, 541 status_code, peer_capab, 542 buf, len); 543 } 544 return -1; 545 } 546 547 static inline int wpa_drv_tdls_oper(struct wpa_supplicant *wpa_s, 548 enum tdls_oper oper, const u8 *peer) 549 { 550 if (!wpa_s->driver->tdls_oper) 551 return -1; 552 return wpa_s->driver->tdls_oper(wpa_s->drv_priv, oper, peer); 553 } 554 555 #ifdef ANDROID 556 static inline int wpa_drv_driver_cmd(struct wpa_supplicant *wpa_s, 557 char *cmd, char *buf, size_t buf_len) 558 { 559 if (!wpa_s->driver->driver_cmd) 560 return -1; 561 return wpa_s->driver->driver_cmd(wpa_s->drv_priv, cmd, buf, buf_len); 562 } 563 #endif /* ANDROID */ 564 565 static inline void wpa_drv_set_rekey_info(struct wpa_supplicant *wpa_s, 566 const u8 *kek, const u8 *kck, 567 const u8 *replay_ctr) 568 { 569 if (!wpa_s->driver->set_rekey_info) 570 return; 571 wpa_s->driver->set_rekey_info(wpa_s->drv_priv, kek, kck, replay_ctr); 572 } 573 574 static inline int wpa_drv_radio_disable(struct wpa_supplicant *wpa_s, 575 int disabled) 576 { 577 if (!wpa_s->driver->radio_disable) 578 return -1; 579 return wpa_s->driver->radio_disable(wpa_s->drv_priv, disabled); 580 } 581 582 static inline int wpa_drv_switch_channel(struct wpa_supplicant *wpa_s, 583 struct csa_settings *settings) 584 { 585 if (!wpa_s->driver->switch_channel) 586 return -1; 587 return wpa_s->driver->switch_channel(wpa_s->drv_priv, settings); 588 } 589 590 static inline int wpa_drv_wnm_oper(struct wpa_supplicant *wpa_s, 591 enum wnm_oper oper, const u8 *peer, 592 u8 *buf, u16 *buf_len) 593 { 594 if (!wpa_s->driver->wnm_oper) 595 return -1; 596 return wpa_s->driver->wnm_oper(wpa_s->drv_priv, oper, peer, buf, 597 buf_len); 598 } 599 600 static inline int wpa_drv_status(struct wpa_supplicant *wpa_s, 601 char *buf, size_t buflen) 602 { 603 if (!wpa_s->driver->status) 604 return -1; 605 return wpa_s->driver->status(wpa_s->drv_priv, buf, buflen); 606 } 607 608 static inline int wpa_drv_set_qos_map(struct wpa_supplicant *wpa_s, 609 const u8 *qos_map_set, u8 qos_map_set_len) 610 { 611 if (!wpa_s->driver->set_qos_map) 612 return -1; 613 return wpa_s->driver->set_qos_map(wpa_s->drv_priv, qos_map_set, 614 qos_map_set_len); 615 } 616 617 static inline int wpa_drv_wowlan(struct wpa_supplicant *wpa_s, 618 const struct wowlan_triggers *triggers) 619 { 620 if (!wpa_s->driver->set_wowlan) 621 return -1; 622 return wpa_s->driver->set_wowlan(wpa_s->drv_priv, triggers); 623 } 624 625 static inline int wpa_drv_vendor_cmd(struct wpa_supplicant *wpa_s, 626 int vendor_id, int subcmd, const u8 *data, 627 size_t data_len, struct wpabuf *buf) 628 { 629 if (!wpa_s->driver->vendor_cmd) 630 return -1; 631 return wpa_s->driver->vendor_cmd(wpa_s->drv_priv, vendor_id, subcmd, 632 data, data_len, buf); 633 } 634 635 636 #ifdef CONFIG_MACSEC 637 638 static inline int wpa_drv_macsec_init(struct wpa_supplicant *wpa_s, 639 struct macsec_init_params *params) 640 { 641 if (!wpa_s->driver->macsec_init) 642 return -1; 643 return wpa_s->driver->macsec_init(wpa_s->drv_priv, params); 644 } 645 646 static inline int wpa_drv_macsec_deinit(struct wpa_supplicant *wpa_s) 647 { 648 if (!wpa_s->driver->macsec_deinit) 649 return -1; 650 return wpa_s->driver->macsec_deinit(wpa_s->drv_priv); 651 } 652 653 static inline int wpa_drv_enable_protect_frames(struct wpa_supplicant *wpa_s, 654 Boolean enabled) 655 { 656 if (!wpa_s->driver->enable_protect_frames) 657 return -1; 658 return wpa_s->driver->enable_protect_frames(wpa_s->drv_priv, enabled); 659 } 660 661 static inline int wpa_drv_set_replay_protect(struct wpa_supplicant *wpa_s, 662 Boolean enabled, u32 window) 663 { 664 if (!wpa_s->driver->set_replay_protect) 665 return -1; 666 return wpa_s->driver->set_replay_protect(wpa_s->drv_priv, enabled, 667 window); 668 } 669 670 static inline int wpa_drv_set_current_cipher_suite(struct wpa_supplicant *wpa_s, 671 const u8 *cs, size_t cs_len) 672 { 673 if (!wpa_s->driver->set_current_cipher_suite) 674 return -1; 675 return wpa_s->driver->set_current_cipher_suite(wpa_s->drv_priv, cs, 676 cs_len); 677 } 678 679 static inline int wpa_drv_enable_controlled_port(struct wpa_supplicant *wpa_s, 680 Boolean enabled) 681 { 682 if (!wpa_s->driver->enable_controlled_port) 683 return -1; 684 return wpa_s->driver->enable_controlled_port(wpa_s->drv_priv, enabled); 685 } 686 687 static inline int wpa_drv_get_receive_lowest_pn(struct wpa_supplicant *wpa_s, 688 u32 channel, u8 an, 689 u32 *lowest_pn) 690 { 691 if (!wpa_s->driver->get_receive_lowest_pn) 692 return -1; 693 return wpa_s->driver->get_receive_lowest_pn(wpa_s->drv_priv, channel, 694 an, lowest_pn); 695 } 696 697 static inline int wpa_drv_get_transmit_next_pn(struct wpa_supplicant *wpa_s, 698 u32 channel, u8 an, 699 u32 *next_pn) 700 { 701 if (!wpa_s->driver->get_transmit_next_pn) 702 return -1; 703 return wpa_s->driver->get_transmit_next_pn(wpa_s->drv_priv, channel, 704 an, next_pn); 705 } 706 707 static inline int wpa_drv_set_transmit_next_pn(struct wpa_supplicant *wpa_s, 708 u32 channel, u8 an, 709 u32 next_pn) 710 { 711 if (!wpa_s->driver->set_transmit_next_pn) 712 return -1; 713 return wpa_s->driver->set_transmit_next_pn(wpa_s->drv_priv, channel, 714 an, next_pn); 715 } 716 717 static inline int wpa_drv_get_available_receive_sc(struct wpa_supplicant *wpa_s, 718 u32 *channel) 719 { 720 if (!wpa_s->driver->get_available_receive_sc) 721 return -1; 722 return wpa_s->driver->get_available_receive_sc(wpa_s->drv_priv, 723 channel); 724 } 725 726 static inline int 727 wpa_drv_create_receive_sc(struct wpa_supplicant *wpa_s, u32 channel, 728 const u8 *sci_addr, u16 sci_port, 729 unsigned int conf_offset, int validation) 730 { 731 if (!wpa_s->driver->create_receive_sc) 732 return -1; 733 return wpa_s->driver->create_receive_sc(wpa_s->drv_priv, channel, 734 sci_addr, sci_port, conf_offset, 735 validation); 736 } 737 738 static inline int wpa_drv_delete_receive_sc(struct wpa_supplicant *wpa_s, 739 u32 channel) 740 { 741 if (!wpa_s->driver->delete_receive_sc) 742 return -1; 743 return wpa_s->driver->delete_receive_sc(wpa_s->drv_priv, channel); 744 } 745 746 static inline int wpa_drv_create_receive_sa(struct wpa_supplicant *wpa_s, 747 u32 channel, u8 an, 748 u32 lowest_pn, const u8 *sak) 749 { 750 if (!wpa_s->driver->create_receive_sa) 751 return -1; 752 return wpa_s->driver->create_receive_sa(wpa_s->drv_priv, channel, an, 753 lowest_pn, sak); 754 } 755 756 static inline int wpa_drv_enable_receive_sa(struct wpa_supplicant *wpa_s, 757 u32 channel, u8 an) 758 { 759 if (!wpa_s->driver->enable_receive_sa) 760 return -1; 761 return wpa_s->driver->enable_receive_sa(wpa_s->drv_priv, channel, an); 762 } 763 764 static inline int wpa_drv_disable_receive_sa(struct wpa_supplicant *wpa_s, 765 u32 channel, u8 an) 766 { 767 if (!wpa_s->driver->disable_receive_sa) 768 return -1; 769 return wpa_s->driver->disable_receive_sa(wpa_s->drv_priv, channel, an); 770 } 771 772 static inline int 773 wpa_drv_get_available_transmit_sc(struct wpa_supplicant *wpa_s, u32 *channel) 774 { 775 if (!wpa_s->driver->get_available_transmit_sc) 776 return -1; 777 return wpa_s->driver->get_available_transmit_sc(wpa_s->drv_priv, 778 channel); 779 } 780 781 static inline int 782 wpa_drv_create_transmit_sc(struct wpa_supplicant *wpa_s, u32 channel, 783 const u8 *sci_addr, u16 sci_port, 784 unsigned int conf_offset) 785 { 786 if (!wpa_s->driver->create_transmit_sc) 787 return -1; 788 return wpa_s->driver->create_transmit_sc(wpa_s->drv_priv, channel, 789 sci_addr, sci_port, 790 conf_offset); 791 } 792 793 static inline int wpa_drv_delete_transmit_sc(struct wpa_supplicant *wpa_s, 794 u32 channel) 795 { 796 if (!wpa_s->driver->delete_transmit_sc) 797 return -1; 798 return wpa_s->driver->delete_transmit_sc(wpa_s->drv_priv, channel); 799 } 800 801 static inline int wpa_drv_create_transmit_sa(struct wpa_supplicant *wpa_s, 802 u32 channel, u8 an, 803 u32 next_pn, 804 Boolean confidentiality, 805 const u8 *sak) 806 { 807 if (!wpa_s->driver->create_transmit_sa) 808 return -1; 809 return wpa_s->driver->create_transmit_sa(wpa_s->drv_priv, channel, an, 810 next_pn, confidentiality, sak); 811 } 812 813 static inline int wpa_drv_enable_transmit_sa(struct wpa_supplicant *wpa_s, 814 u32 channel, u8 an) 815 { 816 if (!wpa_s->driver->enable_transmit_sa) 817 return -1; 818 return wpa_s->driver->enable_transmit_sa(wpa_s->drv_priv, channel, an); 819 } 820 821 static inline int wpa_drv_disable_transmit_sa(struct wpa_supplicant *wpa_s, 822 u32 channel, u8 an) 823 { 824 if (!wpa_s->driver->disable_transmit_sa) 825 return -1; 826 return wpa_s->driver->disable_transmit_sa(wpa_s->drv_priv, channel, an); 827 } 828 #endif /* CONFIG_MACSEC */ 829 830 #endif /* DRIVER_I_H */ 831